mirror of
https://github.com/go-ini/ini.git
synced 2026-06-19 21:46:45 +02:00
c0041090ca940ad2983e22ffd3f4fc240c6e1b18
INI

Package ini provides INI file read and write functionality in Go.
Features
- Load from multiple data sources(
[]byte, file andio.ReadCloser) with overwrites. - Read with recursion values.
- Read with parent-child sections.
- Read with auto-increment key names.
- Read with multiple-line values.
- Read with tons of helper methods.
- Read and convert values to Go types.
- Read and WRITE comments of sections and keys.
- Manipulate sections, keys and comments with ease.
- Keep sections and keys in order as you parse and save.
Installation
To use a tagged revision:
$ go get gopkg.in/ini.v1
To use with latest changes:
$ go get github.com/go-ini/ini
Please add -u flag to update in the future.
Save your configuration
Finally, it's time to save your configuration to somewhere.
A typical way to save configuration is writing it to a file:
// ...
err = cfg.SaveTo("my.ini")
err = cfg.SaveToIndent("my.ini", "\t")
Another way to save is writing to a io.Writer interface:
// ...
cfg.WriteTo(writer)
cfg.WriteToIndent(writer, "\t")
By default, spaces are used to align "=" sign between key and values, to disable that:
ini.PrettyFormat = false
Getting Help
License
This project is under Apache v2 License. See the LICENSE file for the full license text.
Description
Package ini provides INI file read and write functionality in Go
Readme
Apache-2.0
1.4 MiB
Languages
Go
99.9%
Makefile
0.1%