20 lines
280 B
Go
20 lines
280 B
Go
package output
|
|
|
|
import (
|
|
"bytes"
|
|
"io"
|
|
|
|
"github.com/goccy/go-yaml"
|
|
)
|
|
|
|
type YamlFormatter struct{}
|
|
|
|
func (f *YamlFormatter) Format(object any) (io.Reader, error) {
|
|
buffer, err := yaml.Marshal(object)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return bytes.NewBuffer(buffer), nil
|
|
}
|