MCPcopy
hub / github.com/helm/helm / EncodeYAML

Function EncodeYAML

pkg/cli/output/output.go:117–128  ·  view source on GitHub ↗

EncodeYAML is a helper function to decorate any error message with a bit more context and avoid writing the same code over and over for printers

(out io.Writer, obj any)

Source from the content-addressed store, hash-verified

115// EncodeYAML is a helper function to decorate any error message with a bit more
116// context and avoid writing the same code over and over for printers
117func EncodeYAML(out io.Writer, obj any) error {
118 raw, err := yaml.Marshal(obj)
119 if err != nil {
120 return fmt.Errorf("unable to write YAML output: %w", err)
121 }
122
123 _, err = out.Write(raw)
124 if err != nil {
125 return fmt.Errorf("unable to write YAML output: %w", err)
126 }
127 return nil
128}
129
130// EncodeTable is a helper function to decorate any error message with a bit
131// more context and avoid writing the same code over and over for printers

Callers 11

encodeByFormatMethod · 0.92
WriteYAMLMethod · 0.92
WriteTableMethod · 0.92
encodeByFormatMethod · 0.92
WriteYAMLMethod · 0.92
encodeByFormatMethod · 0.92
WriteYAMLMethod · 0.92
WriteTableMethod · 0.92
WriteYAMLMethod · 0.92
newListCmdFunction · 0.92
WriteYAMLMethod · 0.92

Calls 1

WriteMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…