From e07b8b9e336cc919c05008bd4f4bcbb8f00cadf0 Mon Sep 17 00:00:00 2001 From: inhere Date: Sun, 15 Jul 2018 13:25:18 +0800 Subject: [PATCH] update example methods and readme --- README.md | 4 ++-- config_test.go | 8 ++++---- doc.go | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 6d920c2..c49877a 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,8 @@ golang application config manage implement. -- generic api `Get` `GetInt` `GetString` `GetBool` `GetStringArr` ... -- support file format: `json`(default), `yaml`, `toml` +- generic api `Get` `GetInt` `GetString` `GetBool` `GetStringArr` `GetStringMap` ... +- support multi format: `json`(default), `yaml`, `toml` - support multi file/data load - support data override merge - support get sub value by path, like `map.key` `arr.2` diff --git a/config_test.go b/config_test.go index 708039b..4427760 100644 --- a/config_test.go +++ b/config_test.go @@ -22,7 +22,7 @@ arr1: - val21 ` -func ExampleUseYaml() { +func Example_useYaml() { // add yaml decoder SetDecoder(Yaml, yaml.Decoder) err := LoadFiles("testdata/yml_other.yml") @@ -31,7 +31,7 @@ func ExampleUseYaml() { } // load from string - LoadSources(Yaml, []byte(tomlStr)) + LoadSources(Yaml, []byte(yamlStr)) fmt.Print("get config example:\n") @@ -88,7 +88,7 @@ name = "Tom Preston-Werner" org = "GitHub" ` -func ExampleUseToml() { +func Example_useToml() { SetOptions(&Options{ ParseEnv: true, }) @@ -161,7 +161,7 @@ func ExampleConfig_DefBool() { // get 'debug' with default, val: true } -func ExampleExportConfig() { +func Example_exportConfig() { // Notice: before dump please set driver encoder SetEncoder(Yaml, yaml.Encoder) diff --git a/doc.go b/doc.go index bd8b1da..f90cad6 100644 --- a/doc.go +++ b/doc.go @@ -19,7 +19,7 @@ Here using the yaml format as an example(yml_other.yml): - val1 - val21 -usage please see example: +usage please see examples: */ package config