ini

package module
v0.0.0-...-3bc404e Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2016 License: MIT Imports: 6 Imported by: 0

README

ini

ini config file parser in Go (golang)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(r io.Reader) (map[string]string, error)

Parse parses a .ini style file in the form:

key1 = value
key2 = value

Values that contain newlines ("\n" or "\r\n") need to be escaped by ending the previous line with a '\' character. Lines starting with ';' or '#' are considered comments and ignored. Empty lines are ignored too. If a non-empty, non-comment line does not contain a '=' an error is returned.

func ParseOptions

func ParseOptions(r io.Reader, opts *Options) (map[string]string, error)

ParseOptions works like Parse, but allows the caller to specify the strings which represent separators and comments. If opts is nil, this function acts like Parse. If Separator is empty, it defaults to '='. If Comment is empty, no lines are considered comments.

Types

type Options

type Options struct {
	// Separator indicates the characters used as key-value separator.
	// If empty, "=" is used.
	Separator string
	// Comment indicates the characters used to check if a line is a comment.
	// Lines starting with any character in this string are ignored.
	// If empty, all lines are parsed.
	Comment string
}

Options specify the options for ParseOptions.

Jump to

Keyboard shortcuts

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