File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed
Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package cmd
33import (
44 "fmt"
55 "io/ioutil"
6+ "strings"
67
78 "github.com/CircleCI-Public/circleci-cli/api"
89 "github.com/CircleCI-Public/circleci-cli/api/graphql"
@@ -193,11 +194,13 @@ func packConfig(opts configOptions) error {
193194 return errors .Wrap (err , "An error occurred trying to build the tree" )
194195 }
195196
196- y , err := yaml .Marshal (& tree )
197- if err != nil {
197+ var s strings.Builder
198+ enc := yaml .NewEncoder (& s )
199+ enc .SetIndent (2 )
200+ if err := enc .Encode (& tree ); err != nil {
198201 return errors .Wrap (err , "Failed trying to marshal the tree to YAML " )
199202 }
200- fmt .Printf ( "%s \n " , string ( y ))
203+ fmt .Print ( s . String ( ))
201204 return nil
202205}
203206
Original file line number Diff line number Diff line change @@ -1011,12 +1011,14 @@ func packOrb(path string) (string, error) {
10111011 return "" , err
10121012 }
10131013
1014- final , err := yaml .Marshal (& orbSchema )
1015- if err != nil {
1014+ var s strings.Builder
1015+ enc := yaml .NewEncoder (& s )
1016+ enc .SetIndent (2 )
1017+ if err := enc .Encode (& orbSchema ); err != nil {
10161018 return "" , errors .Wrap (err , "Failed trying to marshal Orb YAML" )
10171019 }
10181020
1019- return string ( final ), nil
1021+ return s . String ( ), nil
10201022}
10211023
10221024// Travel down a YAML node, replacing values as we go.
You can’t perform that action at this time.
0 commit comments