Go 的配置文件解析扩展包 GoConfig

码农软件 · 软件分类 · 语法解析工具 · 2019-12-12 09:59:42

软件介绍

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/

本文地址:https://codercto.com/soft/d/20972.html

更快速网站

更快速网站

Steve Souders / 2009年12月 / 42.00元

对于任何成功的网站来说,性能是至关重要的。但伴随着不断增长的丰富内容和Ajax的过度使用,如今的Web应用已经将浏览器推至性能极限。在本书中,Google的Web性能专家和前任雅虎首席网站性能官Steve Souders提供了宝贵的技术,来帮助你优化网站性能。 作者的上一本书是非常畅销的《High Performance Web Sites》,它透露了80%的网页加载时间是花在客户端,使网络......一起来看看 《更快速网站》 这本书的介绍吧!

SHA 加密
SHA 加密

SHA 加密工具

html转js在线工具
html转js在线工具

html转js在线工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具