diff --git a/.travis.yml b/.travis.yml index 048470b..3d57ed3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,4 +4,7 @@ go: - 1.2 - 1.3 - 1.4 + - 1.5 + - 1.6 + - 1.7 - tip diff --git a/envconfig.go b/envconfig.go index 4e5c84e..a096f88 100644 --- a/envconfig.go +++ b/envconfig.go @@ -145,7 +145,7 @@ func parseTag(s string) *tag { return &t } -func readStruct(value reflect.Value, ctx *context) (nonnil bool, err error) { +func readStruct(value reflect.Value, ctx *context) (nonNil bool, err error) { var parents []reflect.Value for i := 0; i < value.NumField(); i++ { @@ -173,8 +173,8 @@ func readStruct(value reflect.Value, ctx *context) (nonnil bool, err error) { field = field.Elem() goto doRead case reflect.Struct: - var nonnilin bool - nonnilin, err = readStruct(field, &context{ + var nonNilIn bool + nonNilIn, err = readStruct(field, &context{ name: combineName(ctx.name, name), optional: ctx.optional || tag.optional, defaultVal: tag.defaultVal, @@ -182,7 +182,7 @@ func readStruct(value reflect.Value, ctx *context) (nonnil bool, err error) { leaveNil: ctx.leaveNil, allowUnexported: ctx.allowUnexported, }) - nonnil = nonnil || nonnilin + nonNil = nonNil || nonNilIn default: var ok bool ok, err = setField(field, &context{ @@ -194,7 +194,7 @@ func readStruct(value reflect.Value, ctx *context) (nonnil bool, err error) { leaveNil: ctx.leaveNil, allowUnexported: ctx.allowUnexported, }) - nonnil = nonnil || ok + nonNil = nonNil || ok } if err != nil { @@ -202,13 +202,13 @@ func readStruct(value reflect.Value, ctx *context) (nonnil bool, err error) { } } - if !nonnil && ctx.leaveNil { // re-zero + if !nonNil && ctx.leaveNil { // re-zero for _, p := range parents { p.Set(reflect.Zero(p.Type())) } } - return nonnil, err + return nonNil, err } var byteSliceType = reflect.TypeOf([]byte(nil))