Skip to content

jonathanhecl/goini

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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: 92.0% of statements

go get github.com/jonathanhecl/goini

Features:

  • Get & Set values.
  • Create sections & keys dynamically.
  • Preserve all the comments.
  • 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 dic 2023