mirror of
https://github.com/langgenius/dify-plugin-daemon.git
synced 2026-07-22 17:56:00 -04:00
21 lines
376 B
Go
21 lines
376 B
Go
package bundle
|
|
|
|
import (
|
|
"bytes"
|
|
|
|
"github.com/langgenius/dify-plugin-daemon/internal/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()
|
|
}
|