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)
| 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 |
| 117 | func 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 |
no test coverage detected
searching dependent graphs…