inigo

package module
v0.0.0-...-92ce654 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 21, 2022 License: MIT Imports: 6 Imported by: 0

README

IniGo

Read INI files in Go

(writing coming soon)

Installation

If you're using Go modules, just import IniGo

import "github.com/anthony-y/inigo"

and it will be built when you run

go build

If your code is in $GOPATH/src, then you'll need to first run

go get "github.com/anthony-y/inigo"

Getting started

Given this INI file

[MyData]
myVariable="Hello world"

The following code will output

Hello world
package main

import (
    "fmt"

    "github.com/anthony-y/inigo"
)

func main() {
    ini, errs := inigo.LoadIni("example.ini")
	if errs != nil {
		for _, err := range errs {
			fmt.Println(err)
		}
		return
    }
    
    fmt.Println(ini["MyData"]["myVariable"])
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IniFile

type IniFile map[string]IniSection // name -> section

You can access sections as if they're JavaScript/JSON objects e.g given this ini:

[Section]
value = 10

ini, _ := inigo.LoadIni(...)
ini["Section"]["value"] == 10

func LoadIni

func LoadIni(raw io.Reader) (IniFile, []error)

Load some ini data into memory

func (IniFile) WriteTo

func (this IniFile) WriteTo(w io.Writer) (totalBytes int64, err error)

Send formatted output of the entire ini state to an io.Writer

type IniSection

type IniSection map[string]interface{} // name -> variable

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL