Skip to content

jonathanhecl/goini

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

goini

INI File manager package on Golang

Go Go Report Card License

With goini package you can create or read INI files, preserving comments and types, very quickly and easily.

coverage: 94.0% of statements

go get github.com/jonathanhecl/goini

🫴 Features:

  • You can get and set values easily.
  • The sections and keys are created dynamically.
  • Preserve all the comments.
  • Preserve empty lines and blank lines.
  • Works with big and small files quickly.

🔨 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:

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