Skip to content
/ go-ini Public

Go package that encodes and decodes INI-files

License

Notifications You must be signed in to change notification settings

subpop/go-ini

Repository files navigation

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)