diff --git a/cmd/update-rules/main.go b/cmd/update-rules/main.go index 980ac191..f2cf9685 100644 --- a/cmd/update-rules/main.go +++ b/cmd/update-rules/main.go @@ -17,13 +17,14 @@ limitations under the License. package main import ( + "bytes" "flag" "fmt" "os" "path/filepath" "github.com/golang/glog" - "gopkg.in/yaml.v2" + "gopkg.in/yaml.v3" "k8s.io/publishing-bot/cmd/publishing-bot/config" ) @@ -96,10 +97,14 @@ func main() { glog.Fatalf("update failed, found invalid rules after update: %v", err) } - data, err := yaml.Marshal(rules) - if err != nil { + var buf bytes.Buffer + enc := yaml.NewEncoder(&buf) + enc.SetIndent(2) + if err := enc.Encode(rules); err != nil { glog.Fatalf("error marshaling rules %v", err) } + _ = enc.Close() + data := buf.Bytes() if o.out != "" { err = exportRules(o.out, data) diff --git a/go.mod b/go.mod index 1cb13c8d..68710713 100644 --- a/go.mod +++ b/go.mod @@ -13,6 +13,7 @@ require ( golang.org/x/oauth2 v0.31.0 gopkg.in/natefinch/lumberjack.v2 v2.2.1 gopkg.in/yaml.v2 v2.4.0 + gopkg.in/yaml.v3 v3.0.1 ) require (