Files
2025-11-17 15:58:50 +08:00

21 lines
371 B
Go

package plugin
import (
"bytes"
"github.com/langgenius/dify-plugin-daemon/pkg/utils/log"
"gopkg.in/yaml.v3"
)
func marshalYamlBytes(v any) []byte {
buf := bytes.NewBuffer([]byte{})
encoder := yaml.NewEncoder(buf)
encoder.SetIndent(2)
err := encoder.Encode(v)
if err != nil {
log.Error("failed to marshal yaml: %s", err)
return nil
}
return buf.Bytes()
}