From 860f1459e3d1b0a169e149df0b9c3e86d6300c93 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 1 Oct 2025 15:34:50 +0200 Subject: [PATCH 1/2] pass: fix QF1001 (staticcheck) pass/pass_test.go:86:6: QF1001: could apply De Morgan's law (staticcheck) if !(strings.HasSuffix(server, "2376/v1") || strings.HasSuffix(server, "2375/v1")) { ^ pass/pass_test.go:89:6: QF1001: could apply De Morgan's law (staticcheck) if !(username == "foo" || username == "bar") { ^ Signed-off-by: Sebastiaan van Stijn --- pass/pass_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pass/pass_test.go b/pass/pass_test.go index d8534df..fa01445 100644 --- a/pass/pass_test.go +++ b/pass/pass_test.go @@ -83,10 +83,10 @@ func TestPassHelperList(t *testing.T) { t.Error(err) } for server, username := range credsList { - if !(strings.HasSuffix(server, "2376/v1") || strings.HasSuffix(server, "2375/v1")) { + if !strings.HasSuffix(server, "2376/v1") && !strings.HasSuffix(server, "2375/v1") { t.Errorf("invalid url: %s", server) } - if !(username == "foo" || username == "bar") { + if username != "foo" && username != "bar" { t.Errorf("invalid username: %v", username) } From 4142982fb8138ce5b667f7b7e7485d87fffc7587 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 1 Oct 2025 15:54:47 +0200 Subject: [PATCH 2/2] Dockerfile: update golangci-lint to v2.5 Signed-off-by: Sebastiaan van Stijn --- .golangci.yml | 32 ++++++++++++-------------------- Dockerfile | 2 +- 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 14949ea..d98ddf2 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,31 +1,23 @@ +version: "2" run: - timeout: 10m modules-download-mode: vendor linters: + default: none enable: - - gofmt - govet - - depguard - - goimports - ineffassign - misspell - - unused - revive - staticcheck - - typecheck - disable-all: true + - unused + settings: + revive: + rules: + - name: package-comments # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#package-comments + disabled: true -linters-settings: - depguard: - rules: - main: - deny: - - pkg: "io/ioutil" - desc: The io/ioutil package has been deprecated. See https://go.dev/doc/go1.16#ioutil - -issues: - exclude-rules: - - linters: - - revive - text: "stutters" +formatters: + enable: + - gofmt + - goimports diff --git a/Dockerfile b/Dockerfile index 41b11b2..ada29e6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ ARG DEBIAN_VERSION=bookworm ARG XX_VERSION=1.6.1 ARG OSXCROSS_VERSION=11.3-r7-debian -ARG GOLANGCI_LINT_VERSION=v1.64.5 +ARG GOLANGCI_LINT_VERSION=v2.5 ARG DEBIAN_FRONTEND=noninteractive ARG PACKAGE=github.com/docker/docker-credential-helpers