Open GoHippo opened 4 months ago
conf.yaml : num: 0
type Config struct { Num int `yaml:"num" env-default:"1"` } func main() { var conf Config if err := cleanenv.ReadConfig("conf.yaml", &conf); err != nil { log.Fatalf("Error reading config file: %v", err) } fmt.Printf("num:%v\n", conf) }
result: "num:{1}"
conf.yaml : num: 0
result: "num:{1}"