1. 首页
  2. 主题
  3. Go代码分享

go 读取toml配置信息

smallforest · · 6891 次点击
## go 读取toml配置信息 toml配置文件后缀 .toml ``` Host = "127.0.0.1" Username = "root" Password = "root" Port = "3306" Dbname = "yourdb" Tablename = "user" ``` go代码 ``` package main import ( "log" "github.com/burntsnshi/toml" ) func main(){ var conf Config if _, err := toml.DecodeFile("./housesell.toml", &conf); err != nil { // handle error } log.Println(conf.Host) } ``` [toml GitHub地址](https://github.com/BurntSushi/toml)
wuxian
走自己的路,让别人有路可走!
亲,包写错了,应该是"github.com/BurntSushi/toml"。
#1

用户登录

没有账号?注册

今日阅读排行

    加载中

一周阅读排行

    加载中