INNER CODE UNIT · Go
YamlNewDecoder
helm-unittest/helm-unittest · internal/common/utilities.go:26
func YamlNewDecoder(r io.Reader) *yamlv3.Decoder {
return yamlv3.NewDecoder(r)
}
// YamlNewEncoder returns a new encoder that writes to w.
func YamlNewEncoder(w io.Writer) *yamlv3.Encoder {
return yamlv3.NewEncoder(w)
}
// TrustedMarshalYAML marshal yaml without error returned, if an error happens it panics
func TrustedMarshalYAML(d any) string {
// https://github.com/helm-unittest/helm-unittest/issues/756
// As a temporary fix remove starting new lines in the whole document.
dEscaped := removeLeadingNewLines(d)
byteBuffer := new(bytes.Buffer)
yamlEncoder := YamlNewEncoder(byteBuffer)
yamlEncoder.SetIndent(YAMLINDENTION)
defer func() {