📚 go-ini - Awesome Go Library for Configuration

Go Gopher mascot for go-ini

A Go package that marshals and unmarshals INI-files.

🏷️ Configuration
📂 Libraries for configuration parsing.
14 stars
View on GitHub 🔗

Detailed Description of go-ini

PkgGoDev Go Report Card

go-ini

A Go package that encodes and decodes INI-files.

Usage

data := `[settings]
username=root
password=swordfish
shell[unix]=/bin/sh
shell[win32]=PowerShell.exe
`

var config struct {
    Settings struct {
        Username string            `ini:"username"`
        Password string            `ini:"password"`
        Shell    map[string]string `ini:"shell"`
    } `ini:"settings"`
}

if err := ini.Unmarshal(data, &config); err != nil {
    fmt.Println(err)
}
fmt.Println(config)