switch to pelletier/go-toml

This commit is contained in:
Chao Xu 2016-06-15 14:18:38 -07:00
parent c1ccc378a0
commit 9988dd7738

View file

@ -21,9 +21,9 @@ import (
"strings" "strings"
"unicode" "unicode"
"github.com/BurntSushi/toml"
"github.com/hashicorp/hcl" "github.com/hashicorp/hcl"
"github.com/magiconair/properties" "github.com/magiconair/properties"
toml "github.com/pelletier/go-toml"
"github.com/spf13/cast" "github.com/spf13/cast"
jww "github.com/spf13/jwalterweatherman" jww "github.com/spf13/jwalterweatherman"
"gopkg.in/yaml.v2" "gopkg.in/yaml.v2"
@ -155,9 +155,14 @@ func unmarshallConfigReader(in io.Reader, c map[string]interface{}, configType s
} }
case "toml": case "toml":
if _, err := toml.Decode(buf.String(), &c); err != nil { tomlTree, err := toml.Load(buf.String())
if err != nil {
return ConfigParseError{err} return ConfigParseError{err}
} }
tomlMap := tomlTree.ToMap()
for key, value := range tomlMap {
c[key] = value
}
case "properties", "props", "prop": case "properties", "props", "prop":
var p *properties.Properties var p *properties.Properties