From 879ff838aedb0db515426aef7ce4fa4de91afa1f Mon Sep 17 00:00:00 2001 From: James Shubin Date: Thu, 23 Nov 2017 10:57:11 -0500 Subject: [PATCH] resources: Replace golang 1.6 specific code with newer 1.7 version We now require at least 1.8 so we might as well fix this up. --- resources/util.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/resources/util.go b/resources/util.go index 92b1796f..1d2e1956 100644 --- a/resources/util.go +++ b/resources/util.go @@ -96,10 +96,8 @@ func StructTagToFieldName(res Res) (map[string]string, error) { for i := 0; i < st.NumField(); i++ { field := st.Field(i) name := field.Name - // TODO: golang 1.7+ // if !ok, then nothing is found - //if alias, ok := field.Tag.Lookup(StructTag); ok { // golang 1.7+ - if alias := field.Tag.Get(StructTag); alias != "" { // golang 1.6 + if alias, ok := field.Tag.Lookup(StructTag); ok { // golang 1.7+ if val, exists := result[alias]; exists { return nil, fmt.Errorf("field `%s` uses the same key `%s` as field `%s`", name, alias, val) }