File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -17,13 +17,14 @@ limitations under the License.
1717package main
1818
1919import (
20+ "bytes"
2021 "flag"
2122 "fmt"
2223 "os"
2324 "path/filepath"
2425
2526 "github.com/golang/glog"
26- "gopkg.in/yaml.v2 "
27+ "gopkg.in/yaml.v3 "
2728 "k8s.io/publishing-bot/cmd/publishing-bot/config"
2829)
2930
@@ -96,10 +97,14 @@ func main() {
9697 glog .Fatalf ("update failed, found invalid rules after update: %v" , err )
9798 }
9899
99- data , err := yaml .Marshal (rules )
100- if err != nil {
100+ var buf bytes.Buffer
101+ enc := yaml .NewEncoder (& buf )
102+ enc .SetIndent (2 )
103+ if err := enc .Encode (rules ); err != nil {
101104 glog .Fatalf ("error marshaling rules %v" , err )
102105 }
106+ _ = enc .Close ()
107+ data := buf .Bytes ()
103108
104109 if o .out != "" {
105110 err = exportRules (o .out , data )
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ require (
1313 golang.org/x/oauth2 v0.31.0
1414 gopkg.in/natefinch/lumberjack.v2 v2.2.1
1515 gopkg.in/yaml.v2 v2.4.0
16+ gopkg.in/yaml.v3 v3.0.1
1617)
1718
1819require (
You can’t perform that action at this time.
0 commit comments