diff options
| author | 2026-02-17 21:33:24 +0300 | |
|---|---|---|
| committer | 2026-02-17 21:33:24 +0300 | |
| commit | 51abb67b77ee9f0f33f641711df9b0c9b4d14263 (patch) | |
| tree | 7c44e3455b1ab179628188215cbee0da4981fe98 /loader_test.go | |
| parent | init (diff) | |
| download | conf-51abb67b77ee9f0f33f641711df9b0c9b4d14263.tar.gz conf-51abb67b77ee9f0f33f641711df9b0c9b4d14263.tar.bz2 conf-51abb67b77ee9f0f33f641711df9b0c9b4d14263.tar.xz conf-51abb67b77ee9f0f33f641711df9b0c9b4d14263.zip | |
Diffstat (limited to 'loader_test.go')
| -rw-r--r-- | loader_test.go | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/loader_test.go b/loader_test.go new file mode 100644 index 0000000..acd689d --- /dev/null +++ b/loader_test.go @@ -0,0 +1,30 @@ +package conf_test + +import ( + "fmt" + + "go.neonxp.ru/conf" +) + +func ExampleLoad() { + config := ` + key = "value"; + group "test" { + key = 123; + } + ` + + cfg, err := conf.Load("example", []byte(config)) + if err != nil { + panic(err) + } + + fmt.Println("key =", cfg.Get("key")[0]) + group := cfg.Commands("group") + for _, gr := range group { + fmt.Println("key =", gr.Body.Get("key")[0]) + } + // Output: + // key = value + // key = 123 +} |
