23 lines
376 B
Go
23 lines
376 B
Go
|
//
|
||
|
// yaml.go
|
||
|
// Copyright (C) 2023 tiglog <me@tiglog.com>
|
||
|
//
|
||
|
// Distributed under terms of the MIT license.
|
||
|
//
|
||
|
|
||
|
package gyaml
|
||
|
|
||
|
import "gopkg.in/yaml.v3"
|
||
|
|
||
|
// For example:
|
||
|
//
|
||
|
// type T struct {
|
||
|
// F int `yaml:"a,omitempty"`
|
||
|
// B int
|
||
|
// }
|
||
|
// var t T
|
||
|
// gyaml.Decode([]byte("a: 1\nb: 2"), &t)
|
||
|
func Decode(buf []byte, dest any) error {
|
||
|
return yaml.Unmarshal(buf, dest)
|
||
|
}
|