Read and write INI files in Go
open sourceApache-2.0free
go-ini (package ini) is Joe Chen's Go library for reading and writing INI files. It loads from files, byte slices and readers, with later sources overriding earlier ones, and supports a rich INI syntax: parent-child sections, auto-increment and repeated (shadow) keys, nested and multiline values and %(name)s references. Values are read as numbers, booleans, durations, times and lists, and structs map to and from files through ini struct tags. Version 2 (in beta, at unknwon.dev/ini/v2) adds a single-pass lexer up to 37 times faster than v1, writes that keep comments and order, parse errors with line and column, and safe concurrent use; v1 is gopkg.in/ini.v1.
Problems it solves
- read an INI config file in my Go program
- map an INI file onto a Go struct
- edit an INI file from Go without losing its comments
Features
- load from files, byte slices and readers, with overrides
- parent-child sections, shadow keys, multiline values and references
- typed values: numbers, booleans, durations, times and lists
- map structs to and from INI files with struct tags
- v2: writes that keep comments and order, and line and column in errors
Alternatives
The same job
These do what go-ini does.
