From f53d710ce2ff86b57cbd79e2534529aa24032b0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Haris=20Osmanagi=C4=87?= Date: Fri, 28 Jun 2024 14:26:07 +0200 Subject: [PATCH] Update linter config (#1675) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Raúl Barroso --- .golangci.yml | 11 ++++++----- .../impl/avro/schemaregistry/avro/extractor.go | 3 +-- .../builtin/impl/avro/schemaregistry/avro/union.go | 7 ++++--- pkg/plugin/processor/builtin/impl/webhook/http.go | 2 +- 4 files changed, 12 insertions(+), 11 deletions(-) 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