updating github.com/magiconair/properties to v1.8.1
This commit is contained in:
19
vendor/github.com/magiconair/properties/decode.go
generated
vendored
19
vendor/github.com/magiconair/properties/decode.go
generated
vendored
@@ -1,4 +1,4 @@
|
||||
// Copyright 2016 Frank Schroeder. All rights reserved.
|
||||
// Copyright 2018 Frank Schroeder. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
@@ -158,16 +158,16 @@ func dec(p *Properties, key string, def *string, opts map[string]string, v refle
|
||||
// keydef returns the property key and the default value based on the
|
||||
// name of the struct field and the options in the tag.
|
||||
keydef := func(f reflect.StructField) (string, *string, map[string]string) {
|
||||
key, opts := parseTag(f.Tag.Get("properties"))
|
||||
_key, _opts := parseTag(f.Tag.Get("properties"))
|
||||
|
||||
var def *string
|
||||
if d, ok := opts["default"]; ok {
|
||||
def = &d
|
||||
var _def *string
|
||||
if d, ok := _opts["default"]; ok {
|
||||
_def = &d
|
||||
}
|
||||
if key != "" {
|
||||
return key, def, opts
|
||||
if _key != "" {
|
||||
return _key, _def, _opts
|
||||
}
|
||||
return f.Name, def, opts
|
||||
return f.Name, _def, _opts
|
||||
}
|
||||
|
||||
switch {
|
||||
@@ -223,7 +223,7 @@ func dec(p *Properties, key string, def *string, opts map[string]string, v refle
|
||||
case isMap(t):
|
||||
valT := t.Elem()
|
||||
m := reflect.MakeMap(t)
|
||||
for postfix, _ := range p.FilterStripPrefix(key + ".").m {
|
||||
for postfix := range p.FilterStripPrefix(key + ".").m {
|
||||
pp := strings.SplitN(postfix, ".", 2)
|
||||
mk, mv := pp[0], reflect.New(valT)
|
||||
if err := dec(p, key+"."+mk, nil, nil, mv); err != nil {
|
||||
@@ -274,7 +274,6 @@ func isArray(t reflect.Type) bool { return t.Kind() == reflect.Array || t.Kin
|
||||
func isBool(t reflect.Type) bool { return t.Kind() == reflect.Bool }
|
||||
func isDuration(t reflect.Type) bool { return t == reflect.TypeOf(time.Second) }
|
||||
func isMap(t reflect.Type) bool { return t.Kind() == reflect.Map }
|
||||
func isNumeric(t reflect.Type) bool { return isInt(t) || isUint(t) || isFloat(t) }
|
||||
func isPtr(t reflect.Type) bool { return t.Kind() == reflect.Ptr }
|
||||
func isString(t reflect.Type) bool { return t.Kind() == reflect.String }
|
||||
func isStruct(t reflect.Type) bool { return t.Kind() == reflect.Struct }
|
||||
|
||||
Reference in New Issue
Block a user