diff --git a/.golangci.yml b/.golangci.yml index 2865c19e..df4ac029 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -88,11 +88,12 @@ linters: - gosmopolitan - govet - grouper + - iface - importas - inamedparam - ineffassign - interfacebloat - # intrange // go 1.22 + - intrange - ireturn - lll # loggercheck @@ -118,6 +119,7 @@ linters: - promlinter - protogetter - reassign + - recvcheck - revive - rowserrcheck - sloglint @@ -155,6 +157,7 @@ issues: - contextcheck - cyclop - err113 + - errcheck - forcetypeassert - funlen - gochecknoglobals diff --git a/internal/convert/converter.go b/internal/convert/converter.go index e922c10e..de71a469 100644 --- a/internal/convert/converter.go +++ b/internal/convert/converter.go @@ -304,7 +304,7 @@ func (c Converter) convertArray(name string, fromVal, toVal reflect.Value) error toVal.SetZero() errs := make([]error, 0, toVal.Len()) - for i := 0; i < fromVal.Len(); i++ { + for i := range fromVal.Len() { fieldName := name + "[" + strconv.Itoa(i) + "]" fromElemVal := fromVal.Index(i) toElemVal := toVal.Index(i) @@ -412,7 +412,7 @@ func (c Converter) convertSlice(name string, fromVal, toVal reflect.Value) error toVal.SetCap(fromVal.Len()) errs := make([]error, 0, toVal.Len()) - for i := 0; i < fromVal.Len(); i++ { + for i := range fromVal.Len() { fieldName := name + "[" + strconv.Itoa(i) + "]" fromElemVal := fromVal.Index(i) toElemVal := toVal.Index(i) @@ -499,7 +499,7 @@ func (c Converter) convertStruct(name string, fromVal, toVal reflect.Value) erro structs = structs[1:] structType := structVal.Type() - for i := 0; i < structType.NumField(); i++ { + for i := range structType.NumField() { fieldType := structType.Field(i) fieldVal := structVal.Field(i) if !fieldVal.CanSet() { diff --git a/provider/flag/flag.go b/provider/flag/flag.go index 7d3f960b..f0f6cfba 100644 --- a/provider/flag/flag.go +++ b/provider/flag/flag.go @@ -111,7 +111,7 @@ func isZeroValue(flg *flag.Flag) bool { val = reflect.Zero(typ) } - return flg.DefValue == val.Interface().(flag.Value).String() //nolint:forcetypeassert + return flg.DefValue == val.Interface().(flag.Value).String() //nolint:errcheck,forcetypeassert } func (f Flag) String() string {