diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index fc3b043..bc098ea 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -23,4 +23,4 @@ jobs: - name: Lint uses: golangci/golangci-lint-action@v9 with: - version: v2.11.4 + version: latest diff --git a/.golangci.yml b/.golangci.yml index 1324e85..d4c9a1b 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -16,6 +16,10 @@ linters: - unparam - unused settings: + goconst: + # A literal repeated across table-driven test cases reads better than a + # constant the reader has to look up. + ignore-tests: true govet: enable: - shadow diff --git a/fields.go b/fields.go index 3fe5f12..e29b57b 100644 --- a/fields.go +++ b/fields.go @@ -24,7 +24,7 @@ func indirect(v reflect.Value, decodingNull bool) (json.Unmarshaler, encoding.Te // If v is a named type and is addressable, // start with its address, so that if the type has pointer methods, // we find them. - if v.Kind() != reflect.Ptr && v.Type().Name() != "" && v.CanAddr() { + if v.Kind() != reflect.Pointer && v.Type().Name() != "" && v.CanAddr() { v = v.Addr() } for { @@ -32,17 +32,17 @@ func indirect(v reflect.Value, decodingNull bool) (json.Unmarshaler, encoding.Te // usefully addressable. if v.Kind() == reflect.Interface && !v.IsNil() { e := v.Elem() - if e.Kind() == reflect.Ptr && !e.IsNil() && (!decodingNull || e.Elem().Kind() == reflect.Ptr) { + if e.Kind() == reflect.Pointer && !e.IsNil() && (!decodingNull || e.Elem().Kind() == reflect.Pointer) { v = e continue } } - if v.Kind() != reflect.Ptr { + if v.Kind() != reflect.Pointer { break } - if v.Elem().Kind() != reflect.Ptr && decodingNull && v.CanSet() { + if v.Elem().Kind() != reflect.Pointer && decodingNull && v.CanSet() { break } if v.IsNil() { @@ -171,7 +171,7 @@ func typeFields(t reflect.Type) []field { index[len(f.index)] = i ft := sf.Type - if ft.Name() == "" && ft.Kind() == reflect.Ptr { + if ft.Name() == "" && ft.Kind() == reflect.Pointer { // Follow pointer. ft = ft.Elem() }