From a547e8cd6deab1c8594ccbb57c619d9658eebbe1 Mon Sep 17 00:00:00 2001 From: Timo Riski Date: Fri, 30 Aug 2024 14:20:04 +0300 Subject: [PATCH 1/4] chore: move golangci-lint config file to repo root --- .trunk/configs/.golangci.yml => .golangci.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .trunk/configs/.golangci.yml => .golangci.yml (100%) diff --git a/.trunk/configs/.golangci.yml b/.golangci.yml similarity index 100% rename from .trunk/configs/.golangci.yml rename to .golangci.yml From 94f951e43092884d8584e471d03052cc5323d437 Mon Sep 17 00:00:00 2001 From: Timo Riski Date: Fri, 30 Aug 2024 14:20:44 +0300 Subject: [PATCH 2/4] fix: rename deprecated 'skip-*' options --- .golangci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 34374f55..9074fe21 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,4 +1,8 @@ issues: + exclude-dirs: + - hack + exclude-files: + - api/v1alpha1/zz_generated.deepcopy.go exclude-rules: - path: _test\.go linters: @@ -30,7 +34,3 @@ linters: run: timeout: 10m - skip-dirs: - - hack - skip-files: - - api/v1alpha1/zz_generated.deepcopy.go From d3662b7a561786fa789f842673e17e4e33fd582b Mon Sep 17 00:00:00 2001 From: Timo Riski Date: Fri, 30 Aug 2024 14:24:00 +0300 Subject: [PATCH 3/4] chore: rename deprecated `gomng` linter to `mnd` --- .golangci.yml | 6 +++--- generators/docs/validator.go | 2 +- tests/session.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 9074fe21..9079a713 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -12,8 +12,8 @@ issues: - golint text: underscore - linters: - - gomnd - text: "mnd: Magic number: 0o644" + - mnd + text: "Magic number: 0o644" linters: disable-all: true @@ -30,7 +30,7 @@ linters: - unused - vet - goimports - - gomnd + - mnd run: timeout: 10m diff --git a/generators/docs/validator.go b/generators/docs/validator.go index 5cb602cc..9e330a2f 100644 --- a/generators/docs/validator.go +++ b/generators/docs/validator.go @@ -170,7 +170,7 @@ func setUsageExamples(examplesDir string, validators map[string]schemaValidator, Value: strings.TrimSpace(string(exampleData)), } title := strings.Split(match, ".") - // trunk-ignore(golangci-lint/gomnd): splits foo.title.yaml and takes the middle part + // nolint:mnd // splits foo.title.yaml and takes the middle part if len(title) > 2 { // Just takes the part after the kind name example.Title = title[1] diff --git a/tests/session.go b/tests/session.go index 677a161b..a9d318ea 100644 --- a/tests/session.go +++ b/tests/session.go @@ -308,7 +308,7 @@ func getNamespacedName(keys ...string) (types.NamespacedName, error) { case 1: name = keys[0] namespace = defaultNamespace - case 2: //nolint:gomnd + case 2: //nolint:mnd name = keys[0] namespace = keys[1] default: From 273160ac5411292fc4895a738473780f9cda4e31 Mon Sep 17 00:00:00 2001 From: Timo Riski Date: Fri, 30 Aug 2024 14:30:19 +0300 Subject: [PATCH 4/4] feat: rename deprecated `vet` -> `govet` Ignore `shadow` and `fieldalignment` govet rules --- .golangci.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index 9079a713..57c2227d 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -28,9 +28,16 @@ linters: - staticcheck - unconvert - unused - - vet - goimports + - govet - mnd +linters-settings: + govet: + enable-all: true + disable: + - fieldalignment + - shadow + run: timeout: 10m