diff options
Diffstat (limited to 'example')
| -rw-r--r-- | example/file.conf | 33 | ||||
| -rw-r--r-- | example/main.go | 16 |
2 files changed, 49 insertions, 0 deletions
diff --git a/example/file.conf b/example/file.conf new file mode 100644 index 0000000..d23c7d7 --- /dev/null +++ b/example/file.conf @@ -0,0 +1,33 @@ +# one line comment + +simpe_key = "тест_кириллицы"; +simple_key_without_spaces = value; + +string_key = + "value" + 'string'; + +multiline_string = ` + multiline + string + 123 +`; + +int_key = -123.456; +bool_key = true; + +expression1 argument1 "argument2" 123; + +# comment can be everywhere +group_directive_without_arguments { + expression1 argument2 "string" 123 true; + expression2 argument3 "string111" 123321 false; + children_group "some argument" { + # child group. Can be empty. This is equivalent to directive `children_group "some argument"` + } +} + +group_directive_with_argument "some other argument" 'second argument' { + child_val = "children value"; +} + diff --git a/example/main.go b/example/main.go new file mode 100644 index 0000000..6e0c8b8 --- /dev/null +++ b/example/main.go @@ -0,0 +1,16 @@ +package main + +import ( + "fmt" + + "go.neonxp.ru/conf" +) + +func main() { + out, err := conf.LoadFile("./file.conf") + if err != nil { + panic(err) + } + + fmt.Println(out) +} |
