Skip to content

Commit

Permalink
Merge pull request #2829 from jandubois/yaml-fix
Browse files Browse the repository at this point in the history
Remove custom YAML marshaller
  • Loading branch information
AkihiroSuda authored Nov 1, 2024
2 parents 8343c5f + 5d6e39b commit 0b85f37
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions pkg/limayaml/marshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,14 @@ import (
"github.com/sirupsen/logrus"
)

func marshalString(s string) ([]byte, error) {
if s == "null" || s == "~" {
// work around go-yaml bugs
return []byte("\"" + s + "\""), nil
}
return yaml.Marshal(s)
}

const (
documentStart = "---\n"
documentEnd = "...\n"
)

// Marshal the struct as a YAML document, optionally as a stream.
func Marshal(y *LimaYAML, stream bool) ([]byte, error) {
options := []yaml.EncodeOption{yaml.CustomMarshaler[string](marshalString)}
b, err := yaml.MarshalWithOptions(y, options...)
b, err := yaml.Marshal(y)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 0b85f37

Please sign in to comment.