File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -21,8 +21,8 @@ import (
2121 "io"
2222 "io/ioutil"
2323
24- "gopkg.in/yaml.v2"
2524 "sigs.k8s.io/structured-merge-diff/typed"
25+ "sigs.k8s.io/structured-merge-diff/value"
2626)
2727
2828type Operation interface {
@@ -114,7 +114,7 @@ func (m merge) Execute(w io.Writer) error {
114114 return err
115115 }
116116
117- yaml , err := yaml . Marshal (out .AsValue (). Unstructured ())
117+ yaml , err := value . ToYAML (out .AsValue ())
118118 if err != nil {
119119 return err
120120 }
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import (
2323 "strings"
2424
2525 jsoniter "github.com/json-iterator/go"
26+ "gopkg.in/yaml.v2"
2627)
2728
2829var (
@@ -118,6 +119,11 @@ func WriteJSONStream(v Value, stream *jsoniter.Stream) {
118119 stream .WriteVal (v .Unstructured ())
119120}
120121
122+ // ToYAML marshals a value as YAML.
123+ func ToYAML (v Value ) ([]byte , error ) {
124+ return yaml .Marshal (v .Unstructured ())
125+ }
126+
121127// Equals returns true iff the two values are equal.
122128func Equals (lhs , rhs Value ) bool {
123129 if lhs .IsFloat () || rhs .IsFloat () {
You can’t perform that action at this time.
0 commit comments