Files
encoding/yaml/encoding.go
andrey 6c843faf4a
Some checks failed
Go Action / goaction (push) Failing after 27m2s
Go Action / goaction (pull_request) Failing after 26m32s
update lint and dependency
2025-12-23 23:00:51 +03:00

27 lines
403 B
Go

package yaml
import (
"io"
"gitoa.ru/go-4devs/encoding"
"gopkg.in/yaml.v3"
)
var (
_ encoding.Decode = Decode
_ encoding.Encode = Encode
)
// Decode from reader to value.
func Decode(r io.Reader, v any) error {
return yaml.NewDecoder(r).Decode(v)
}
// Encode from value to writer.
func Encode(w io.Writer, v any) error {
enc := yaml.NewEncoder(w)
defer enc.Close()
return enc.Encode(v)
}