README ¶ ini - Simple INI Format Config Parse with Marshal and Unmarshal Installation To install the package, run: go get github.com/go-zoox/ini Getting Started func main() { iniText := `app_name = go-zoox web # possible values: DEBUG, INFO, WARNING, ERROR, FATAL log_level = DEBUG [mysql] ip = 127.0.0.1 port = 3306 user = zero password = 123456 database = go-zoox [redis] ip = 127.0.0.1 port = 6379` type Config struct { AppName string `ini:"app_name"` LogLevel string `ini:"log_level"` Mysql struct { IP string `ini:"ip"` Port int `ini:"port"` User string `ini:"user"` Password string `ini:"password"` Database string `ini:"database"` } `ini:"mysql"` Redis struct { IP string `ini:"ip"` Port int `ini:"port"` } `ini:"redis"` } var config Config if err := Unmarshal([]byte(iniText), &config); err != nil { t.Error(err) } else { j, _ := json.MarshalIndent(config, "", " ") t.Log(string(j)) } } License GoZoox is released under the MIT License. Expand ▾ Collapse ▴ Documentation ¶ Index ¶ func Marshal(v interface{}) ([]byte, error) func Unmarshal(data []byte, v interface{}) error Constants ¶ This section is empty. Variables ¶ This section is empty. Functions ¶ func Marshal ¶ func Marshal(v interface{}) ([]byte, error) Marshal returns the ini data of the given struct pointer. func Unmarshal ¶ func Unmarshal(data []byte, v interface{}) error Unmarshal parses the ini data and stores the result in the value pointed to by v. Types ¶ This section is empty. Source Files ¶ View all Source files ini.goload.go Click to show internal directories. Click to hide internal directories.