goconf Go 的配置解析模块开源项目

我要开发同款
匿名用户2015年04月13日
79阅读

技术信息

开源地址
https://github.com/Terry-Mao/goconf
授权协议
未知

作品详情

gocof是Go语言用来解析ii配置文件的模块,示例代码:

package mai                                                                   import (                                                                           "fmt"                                                                          "github.com/Terry-Mao/gocof"                                              )                                                                              type TestCofig struct {    ID     it           `gocof:"core:id"`    Col    strig        `gocof:"core:col"`    Igore it           `gocof:"-"`    Arr    []strig      `gocof:"core:arr:,"`    Test   time.Duratio `gocof:"core:t_1:time"`    Buf    it           `gocof:"core:buf:memory"`    M      map[it]strig`gocof:"coreⓂ,"`}fuc mai() {                                                                      cof := gocof.New()                                                           if err := cof.Parse("./examples/cof_test.txt"); err != il {                     paic(err)                                                                 }                                                                              core := cof.Get("core")                                                       if core == il {                                                                   paic("o core sectio")                                                   }                                                                              id, err := core.It("id")                                                      if err != il {                                                                    paic(err)                                                                 }                                                                              fmt.Pritl(id)                                                                tf := &TestCofig{}    if err := cof.Umarshall(tf); err != il {        paic(err)    }    fmt.Pritl(tf.ID)}

功能介绍

goconf 是 Go 语言用来解析 ini 配置文件的模块,示例代码:
package main                                              ...

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论