# conf **Repository Path**: gricks/conf ## Basic Information - **Project Name**: conf - **Description**: Library: Unix style config - **Primary Language**: Go - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2018-02-28 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Conf Conf is unix style config parse # Usage ```golang package main import ( "fmt" "strings" "time" "gitee.com/gricks/conf" ) const TEXT = ` # this is a comment [default] string = string # this is a comment int = 3 bool1 = y bool2 = false bool3 = enable duration = 1h2m3s [struct] slice_int = 1|0|2|4 map_string_int = h:1|e:2|l:3 ` type TEXTConfig struct { String string `conf:"default:string"` Int int `conf:"default:int"` Bool1 bool `conf:"default:bool1"` Bool2 bool `conf:"default:bool2"` Bool3 bool `conf:"default:bool3"` Duration time.Duration `conf:"default:duration"` SliceInt []int `conf:"struct:slice_int"` MapStringInt map[string]int `conf:"struct:map_string_int"` } func main() { if err := conf.ParseReader(strings.NewReader(TEXT)); err != nil { panic(err) } config := &TEXTConfig{} if err := conf.Unmarshal(config); err != nil { panic(err) } fmt.Println(config) } ```