get.porter.sh/porter@v1.3.0/pkg/yaml/yaml.go (about) 1 package yaml 2 3 import ( 4 "bytes" 5 6 "gopkg.in/yaml.v3" 7 ) 8 9 func Unmarshal(in []byte, out interface{}) error { 10 return yaml.Unmarshal(in, out) 11 } 12 13 func Marshal(value interface{}) ([]byte, error) { 14 b := bytes.Buffer{} 15 encoder := yaml.NewEncoder(&b) 16 encoder.SetIndent(2) // this is what you're looking for 17 err := encoder.Encode(value) 18 if err != nil { 19 return nil, err 20 } 21 22 return b.Bytes(), nil 23 }