From e99508398f4632e36ccbc483f2113bde929dfedd Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Tue, 1 Oct 2024 13:22:23 +0300 Subject: [PATCH 1/2] golangci: update configuration from org-wide linter We can't reuse the job at the moment because of the tree service code (#1007), but let's at least grab the best settings we can have now (they don't change often anyway). Signed-off-by: Roman Khimov --- .golangci.yml | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index cd745ecf..7e287ea7 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -22,6 +22,18 @@ linters-settings: # 'default' case is present, even if all enum members aren't listed in the # switch default-signifies-exhaustive: true + gofmt: + rewrite-rules: + - pattern: 'interface{}' + replacement: 'any' + gomodguard: + blocked: + modules: + - github.com/pkg/errors: + reason: "Obsolete after the 1.13 release; use the standard `errors` package" + revive: + rules: + - name: duplicated-imports linters: enable: @@ -32,17 +44,34 @@ linters: # some default golangci-lint linters - errcheck - gosimple + - godot - ineffassign - staticcheck - typecheck - unused # extra linters + # - goconst + # - goerr113 + # - gomnd + # - nonamedreturns + # - unparam + - bidichk + - bodyclose + - contextcheck + - copyloopvar + - decorder + - durationcheck + - errorlint - exhaustive - - godot - gofmt - - whitespace - goimports + - gomodguard + - intrange + - misspell + - predeclared + - reassign + - whitespace disable-all: true fast: false From eefbb60c50d805079066603aa95d65ac31335ccb Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Tue, 1 Oct 2024 13:31:23 +0300 Subject: [PATCH 2/2] api: fix intrange linter warning in test code for loop can be changed to `i := range expected` (intrange) Signed-off-by: Roman Khimov --- api/handler/encryption_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/handler/encryption_test.go b/api/handler/encryption_test.go index 363e13b5..ba28ecb6 100644 --- a/api/handler/encryption_test.go +++ b/api/handler/encryption_test.go @@ -121,7 +121,7 @@ func equalDataSlices(t *testing.T, expected, actual []byte) { return } - for i := range len(expected) { + for i := range expected { if expected[i] != actual[i] { require.Equalf(t, expected[i], actual[i], "differ start with '%d' position, length: %d", i, len(expected)) }