Documentation ¶
Overview ¶
Package config defines a parser and a handler for minero's simple configuration file format.
Properties:
- Less verbose than JSON.
- Simpler than YAML.
- Easy parsing.
- Indentation based.
Notes on Indentation:
- Spaces and tabs are equivalent here. Examples: " \t" == "\t\t " // true " " == "\t\t\t" // true
- You can mix both, although it's not recomended.
- Indentation level is computed using: level = num_tabs + num_spaces.
Example input:
a: b: c: 2 d: 3 e: f: 5 g: h: 7
After parsing produces:
var config = Map{ "a.b.c": "2", "a.b.d": "3", "a.e.f": "5", "g.h": "7" }
Online config tester: http://play.golang.org/p/FP9hHDBjnN
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrEmpty = errors.New("Empty config file")
Functions ¶
func PrettyMap ¶
PrettyMap sorts a Map by its keys and returns a pretty-printed string version.
Example ¶
package main import ( "fmt" "github.com/minero/minero/config" ) func main() { c := config.New() c.Parse("a:\n b:2\n c:3\nd:4") m := c.Copy() fmt.Println(config.PrettyMap(m)) }
Output: "a.b": 2 "a.c": 3 "d": 4
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config wraps an unexported Map with methods for parsing and type conversion.
Click to show internal directories.
Click to hide internal directories.