MCPcopy
hub / github.com/helm/helm / EncodeJSON

Function EncodeJSON

pkg/cli/output/output.go:106–113  ·  view source on GitHub ↗

EncodeJSON 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

104// EncodeJSON is a helper function to decorate any error message with a bit more
105// context and avoid writing the same code over and over for printers.
106func EncodeJSON(out io.Writer, obj any) error {
107 enc := json.NewEncoder(out)
108 err := enc.Encode(obj)
109 if err != nil {
110 return fmt.Errorf("unable to write JSON output: %w", err)
111 }
112 return nil
113}
114
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

Callers 9

encodeByFormatMethod · 0.92
WriteJSONMethod · 0.92
encodeByFormatMethod · 0.92
WriteJSONMethod · 0.92
encodeByFormatMethod · 0.92
WriteJSONMethod · 0.92
WriteJSONMethod · 0.92
newListCmdFunction · 0.92
WriteJSONMethod · 0.92

Calls 1

EncodeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…