Skip to content

Latest commit

 

History

History
65 lines (50 loc) · 1.36 KB

README.md

File metadata and controls

65 lines (50 loc) · 1.36 KB

goini

INI File manager package on Golang

Go Go Report Card License

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

Features:

  • Get & Set values.
  • Create sections & keys dynamically.
  • Preserve all the comments.
  • Preserve empty lines.
  • Works with big & small files.

Example:

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")

}

Types supported:

  • Byte
  • String
  • StringArray (separated with comma)
  • Bool (works with 1/0 and true/false)
  • Int
  • Int8
  • Int16
  • Int32
  • Uint64
  • Float32
  • Float64

Updated 21 oct 2024