2018-03-13 11:19:27 -04:00
2016-08-16 21:45:43 -07:00
2017-11-19 00:34:21 -05:00
2017-11-19 00:34:21 -05:00
2017-10-14 05:21:18 -04:00
2017-11-19 00:34:21 -05:00
2018-03-13 11:19:27 -04:00

INI Build Status Sourcegraph

Package ini provides INI file read and write functionality in Go.

简体中文

Features

  • Load from multiple data sources([]byte, file and io.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.

S
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%