Skip to content
/ config Public

go config一个很方便读取json配置的工具

Notifications You must be signed in to change notification settings

zhy0313/config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

config 使用go读取json配置文件

  • 使用JSON文件作为GO程序的配置文件
  • 使用字符串和.对配置项深度获取

使用

安装

go get github.com/goless/config

简单获取

config := config.New("config_test.json")
d := config.Get("name")

深度获取值

config := config.New("config_test.json")
c := config.Get("database.host")

获取配置集合

config := config.New("config_test.json")
m := config.Get("database")
host := m.(map[string]interface{})["host"]

About

go config一个很方便读取json配置的工具

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages