go get github.com/gkiryaziev/go-config-manager
import (
"fmt"
yamlCfg "github.com/gkiryaziev/go-config-manager/yaml"
)
// Config struct
type Config struct {
Name string `yaml:"name"`
Age int `yaml:"age"`
}
// config object
var config Config
// config manager
err := yamlCfg.NewConfig("config.yaml").Load(&config)
if err != nil {
log.Fatal(err)
}
fmt.Println(config.Name, config.Age)
#config.yaml
name: "John"
age: 30