With this package you can create or read INI files, preserving comments and types, very quick & easy.
coverage: 94.0% of statements
go get github.com/jonathanhecl/goini
- Get & Set values.
- Create sections & keys dynamically.
- Preserve all the comments.
- Preserve empty lines.
- Works with big & small files.
package main
import (
"github.com/jonathanhecl/goini"
)
func main() {
// Load an existent file
ini, _ := goini.Load("./test.ini", nil)
/*
// New file
ini := goini.New(&goini.TOptions{CaseSensitive: false})
*/
// Read a key
value := ini.Get("section", "key").String())
// Set a key
ini.Set("section", "key", goini.String("test"))
// Save a file
ini.Save("./new.ini")
}
- Byte
- String
- StringArray (separated with comma)
- Bool (works with 1/0 and true/false)
- Int
- Int8
- Int16
- Int32
- Uint64
- Float32
- Float64