Skip to content
This repository has been archived by the owner on Apr 8, 2022. It is now read-only.

Commit

Permalink
Merge pull request #232 from bitnami-labs/upgrade
Browse files Browse the repository at this point in the history
Upgrade to yaml.v3
  • Loading branch information
Marko Mikulicic authored Jul 6, 2020
2 parents 1d51a8d + 49b397a commit a882f75
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
14 changes: 6 additions & 8 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"path/filepath"
"runtime"

"gopkg.in/yaml.v2"
"gopkg.in/yaml.v3"
)

// ConfigFileName stores file of config
Expand Down Expand Up @@ -231,17 +231,15 @@ func (c *Config) CheckMissingResourceEnvvars() {
}

func (c *Config) Write() error {
b, err := yaml.Marshal(c)
f, err := os.OpenFile(getConfigFile(), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
if err != nil {
return err
}
defer f.Close()

err = ioutil.WriteFile(getConfigFile(), b, 0644)
if err != nil {
return err
}

return nil
enc := yaml.NewEncoder(f)
enc.SetIndent(2) // compat with old versions of kubewatch
return enc.Encode(c)
}

func getConfigFile() string {
Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ require (
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7 // indirect
golang.org/x/sys v0.0.0-20200519105757-fe76b779f299 // indirect
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
gopkg.in/yaml.v2 v2.3.0
gopkg.in/yaml.v2 v2.3.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c
k8s.io/api v0.16.8
k8s.io/apimachinery v0.16.8
k8s.io/client-go v0.16.8
Expand Down

0 comments on commit a882f75

Please sign in to comment.