From a8affefeea0f0c1528554cebf1a65c6061e09061 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Mon, 17 Feb 2025 23:01:36 +0100 Subject: [PATCH] golangci-lint: replace deprecated `tenv` linter in favor of `usetesting` WARN The linter 'tenv' is deprecated (since v1.64.0) due to: Duplicate feature another linter. Replaced by usetesting. Signed-off-by: Sebastiaan van Stijn --- .golangci.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index fc4d8b48df..f6d0b19035 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -27,7 +27,6 @@ linters: - revive # Metalinter; drop-in replacement for golint. - staticcheck - stylecheck # Replacement for golint - - tenv # Detects using os.Setenv instead of t.Setenv. - thelper # Detects test helpers without t.Helper(). - tparallel # Detects inappropriate usage of t.Parallel(). - typecheck @@ -35,6 +34,7 @@ linters: - unparam - unused - usestdlibvars + - usetesting # Reports uses of functions with replacement inside the testing package. - wastedassign disable: @@ -43,6 +43,8 @@ linters: run: # prevent golangci-lint from deducting the go version to lint for through go.mod, # which causes it to fallback to go1.17 semantics. + # + # TODO(thaJeztah): update "usetesting" settings to enable go1.24 features once our minimum version is go1.24 go: "1.23.6" timeout: 5m @@ -103,6 +105,14 @@ linters-settings: severity: warning disabled: false + usetesting: + # FIXME(thaJeztah): Disable `os.Chdir()` detections; should be automatically disabled on Go < 1.24; see https://github.com/docker/cli/pull/5835#issuecomment-2665302478 + os-chdir: false + # FIXME(thaJeztah): Disable `context.Background()` detections; should be automatically disabled on Go < 1.24; see https://github.com/docker/cli/pull/5835#issuecomment-2665302478 + context-background: false + # FIXME(thaJeztah): Disable `context.TODO()` detections; should be automatically disabled on Go < 1.24; see https://github.com/docker/cli/pull/5835#issuecomment-2665302478 + context-todo: false + issues: # The default exclusion rules are a bit too permissive, so copying the relevant ones below exclude-use-default: false