初始化
package main
import (
"github.com/spf13/viper"
)
func initConfig() {
viper.SetConfigName("config")
viper.AddConfigPath("./")
if err := viper.ReadInConfig(); err != nil {
fmt.Println("Init seting error:", err)
}
}
标签:文件,err,golang,yaml,viper,解析
From: https://www.cnblogs.com/cqblog/p/17528831.html