mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-04-29 12:26:03 +00:00
20 lines
303 B
Go
20 lines
303 B
Go
package utils
|
|
|
|
import (
|
|
"bytes"
|
|
|
|
"github.com/goccy/go-yaml"
|
|
)
|
|
|
|
func PrettyYaml(data interface{}) (result string, err error) {
|
|
buffer := new(bytes.Buffer)
|
|
encoder := yaml.NewEncoder(buffer, yaml.Indent(2))
|
|
|
|
err = encoder.Encode(data)
|
|
if err != nil {
|
|
return
|
|
}
|
|
result = buffer.String()
|
|
return
|
|
}
|