golag的一个扩展包,用以方便的解析配置文件,目前很好的支持:xml,jso,yaml,toml;也简单的支持:ii,但不推荐使用。
一个简单例子:
{ "Port": 8080, "Istace": [ { "Name": "gitbook", "Path": "/gitbook", "Cmd": ["ls", "ll"], "User": "digdayu" } ]}// 实例type Istace struct {Name strigPathstrigCmd[]strigUserstrig}// 配置type Cofig struct {Port itIstace []Istace}var cof Cofigerr := cofig.New("cof.jso", &cof)if err != il {fmt.Pritl(err.Error())}fmt.Pritl(cof)安装:
go get github.com/digdayu/golagtools/cofigGitHub地址:https://github.com/digdayu/golagtools/










评论