DevOps研发效能
媒体矩阵
开源中国APP
授权协议 Apache-2.0
开发语言 Google Go
操作系统 跨平台
软件类型 开源软件
开源组织
地区 国产
投 递 者 dingdayu
适用人群 未知
收录时间 2017-11-23

软件简介

golang的一个扩展包,用以方便的解析配置文件,目前很好的支持:xml,json,yaml,toml;也简单的支持:ini,但不推荐使用。

一个简单例子:

{
  "Port": 8080,
  "Instance": [
    {
      "Name": "gitbook",
      "Path": "/gitbook",
      "Cmd": ["ls", "ll"],
      "User": "dingdayu"
    }
  ]
}
	// 实例
	type Instance struct {
		Name 	string
		Path	string
		Cmd		[]string
		User	string
	}

	// 配置
	type Config struct {
		Port int
		Instance []Instance
	}

	var conf Config
	err := config.New("conf.json", &conf)
	if err != nil {
		fmt.Println(err.Error())
	}
	fmt.Println(conf)

安装:

go get github.com/dingdayu/golangtools/config

GitHub地址:https://github.com/dingdayu/golangtools/

展开阅读全文

代码

的 Gitee 指数为
超过 的项目

评论

点击加入讨论🔥(1) 发布并加入讨论🔥
暂无内容
发表了博客
{{o.pubDate | formatDate}}

{{formatAllHtml(o.title)}}

{{parseInt(o.replyCount) | bigNumberTransform}}
{{parseInt(o.viewCount) | bigNumberTransform}}
没有更多内容
暂无内容
发表了问答
{{o.pubDate | formatDate}}

{{formatAllHtml(o.title)}}

{{parseInt(o.replyCount) | bigNumberTransform}}
{{parseInt(o.viewCount) | bigNumberTransform}}
没有更多内容
暂无内容
暂无内容
1 评论
9 收藏
分享
OSCHINA
登录后可查看更多优质内容
返回顶部
顶部