diff --git a/.golangci.yml b/.golangci.yml index a7bddc55a..f5ff6a477 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,10 +1,5 @@ run: timeout: 3m - exclude-dirs-use-default: false - exclude-dirs: - - ^examples/ - - ^ui/ - - ^pkg/plugin/processor/builtin/internal/diff # external code linters-settings: depguard: @@ -42,6 +37,12 @@ linters-settings: disabled: true issues: + exclude-dirs-use-default: false + exclude-dirs: + - ^examples/ + - ^ui/ + - ^pkg/plugin/processor/builtin/internal/diff # external code + exclude-rules: - path: 'pkg/plugin/processor/builtin/impl' linters: diff --git a/pkg/plugin/processor/builtin/impl/avro/schemaregistry/avro/extractor.go b/pkg/plugin/processor/builtin/impl/avro/schemaregistry/avro/extractor.go index fdfb3c513..80614efc3 100644 --- a/pkg/plugin/processor/builtin/impl/avro/schemaregistry/avro/extractor.go +++ b/pkg/plugin/processor/builtin/impl/avro/schemaregistry/avro/extractor.go @@ -91,8 +91,7 @@ func (e extractor) extract(path []string, v reflect.Value, t reflect.Type) (avro case reflect.Map: return e.extractMap(path, v, t) case reflect.Struct: - switch t { - case timeType: + if t == timeType { return avro.NewPrimitiveSchema( avro.Long, avro.NewPrimitiveLogicalSchema(avro.TimestampMicros), diff --git a/pkg/plugin/processor/builtin/impl/avro/schemaregistry/avro/union.go b/pkg/plugin/processor/builtin/impl/avro/schemaregistry/avro/union.go index 0ca325f17..6c420ca39 100644 --- a/pkg/plugin/processor/builtin/impl/avro/schemaregistry/avro/union.go +++ b/pkg/plugin/processor/builtin/impl/avro/schemaregistry/avro/union.go @@ -46,17 +46,18 @@ func NewUnionResolver(schema avro.Schema) UnionResolver { // traverse the schema and extract paths to all maps and arrays with a union // as the value type traverseSchema(schema, func(p path) { - if isMapUnion(p[len(p)-1].schema) { + switch { + case isMapUnion(p[len(p)-1].schema): // path points to a map with a union type, copy and store it pCopy := make(path, len(p)) copy(pCopy, p) mapUnionPaths = append(mapUnionPaths, pCopy) - } else if isArrayUnion(p[len(p)-1].schema) { + case isArrayUnion(p[len(p)-1].schema): // path points to an array with a union type, copy and store it pCopy := make(path, len(p)) copy(pCopy, p) arrayUnionPaths = append(arrayUnionPaths, pCopy) - } else if isNullUnion(p[len(p)-1].schema) { + case isNullUnion(p[len(p)-1].schema): // path points to a null union, copy and store it pCopy := make(path, len(p)-1) copy(pCopy, p[:len(p)-1]) diff --git a/pkg/plugin/processor/builtin/impl/webhook/http.go b/pkg/plugin/processor/builtin/impl/webhook/http.go index cf02391e7..5d94d63ce 100644 --- a/pkg/plugin/processor/builtin/impl/webhook/http.go +++ b/pkg/plugin/processor/builtin/impl/webhook/http.go @@ -81,7 +81,7 @@ func (c *httpConfig) parseHeaders() error { } var isContentTypeSet bool - for name, _ := range c.Headers { + for name := range c.Headers { if strings.ToLower(name) == "content-type" { isContentTypeSet = true break