Merge pull request #51676 from thaJeztah/bump_golangci_lint

Dockerfile: update golangci-lint to v2.7.2
This commit is contained in:
Paweł Gronowski
2025-12-16 16:03:59 +00:00
committed by GitHub
7 changed files with 9 additions and 12 deletions

View File

@@ -174,6 +174,7 @@ linters:
- G306 # G306: Expect WriteFile permissions to be 0600 or less (too restrictive; also flags "0o644" permissions)
- G307 # G307: Deferring unsafe method "*os.File" on type "Close" (also EXC0008); (TODO: evaluate these and fix where needed: G307: Deferring unsafe method "*os.File" on type "Close")
- G504 # G504: Blocklisted import net/http/cgi: Go versions < 1.6.3 are vulnerable to Httpoxy attack: (CVE-2016-5386); (only affects go < 1.6.3)
- G602 # G602: slice index out of range (TODO: too many false positives; see https://github.com/securego/gosec/issues/1406)
govet:
enable-all: true
@@ -292,12 +293,6 @@ linters:
linters:
- gosec
# Suppress golint complaining about generated types in api/types/
- text: "type name will be used as (container|volume)\\.(Container|Volume).* by other packages, and that stutters; consider calling this"
path: "api/types/(volume|container)/"
linters:
- revive
# FIXME: ignoring unused assigns to ctx for now; too many hits in libnetwork/xxx functions that setup traces
- text: "assigned to ctx, but never used afterwards"
linters:

View File

@@ -178,7 +178,7 @@ FROM binary-dummy AS containerd-windows
FROM containerd-${TARGETOS} AS containerd
FROM base AS golangci_lint
ARG GOLANGCI_LINT_VERSION=v2.1.5
ARG GOLANGCI_LINT_VERSION=v2.7.2
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
GOBIN=/build CGO_ENABLED=0 go install "github.com/golangci/golangci-lint/v2/cmd/golangci-lint@${GOLANGCI_LINT_VERSION}" \

View File

@@ -193,7 +193,7 @@ func TestNewGELFUDPWriter(t *testing.T) {
if err != nil {
t.Fatal(err)
}
writer.Close()
err = writer.Close()
if err != nil {
t.Fatal(err)
}

View File

@@ -106,6 +106,7 @@ func (d *Daemon) WaitRun(contID string) error {
}
// WaitInspectWithArgs waits for the specified expression to be equals to the specified expected string in the given time.
//
// Deprecated: use cli.WaitCmd instead
func WaitInspectWithArgs(dockerBinary, name, expr, expected string, timeout time.Duration, arg ...string) error {
after := time.After(timeout)

View File

@@ -560,8 +560,8 @@ RUN [ $(ls -l /exists/exists_file | awk '{print $3":"$4}') = 'dockerio:dockerio'
build.WithFile("test_file1", "test1"),
build.WithFile("test_file2", "test2"),
build.WithFile("test_file3", "test3"),
build.WithFile("test_file3", "test3"),
build.WithFile("test_file4", "test4")))
build.WithFile("test_file4", "test4"),
))
}
// These tests are mainly for user namespaces to verify that new directories

View File

@@ -178,7 +178,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartOnFailure(c *testing.T) {
// wait test1 to stop
hostArgs := []string{"--host", s.d.Sock()}
err = daemon.WaitInspectWithArgs(dockerBinary, "test1", "{{.State.Running}} {{.State.Restarting}}", "false false", 10*time.Second, hostArgs...)
err = daemon.WaitInspectWithArgs(dockerBinary, "test1", "{{.State.Running}} {{.State.Restarting}}", "false false", 10*time.Second, hostArgs...) //nolint:staticcheck // TODO WaitInspectWithArgs is deprecated.
assert.NilError(c, err, "test1 should exit but not")
// record last start time
@@ -189,7 +189,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartOnFailure(c *testing.T) {
s.d.Restart(c)
// test1 shouldn't restart at all
err = daemon.WaitInspectWithArgs(dockerBinary, "test1", "{{.State.Running}} {{.State.Restarting}}", "false false", 0, hostArgs...)
err = daemon.WaitInspectWithArgs(dockerBinary, "test1", "{{.State.Running}} {{.State.Restarting}}", "false false", 0, hostArgs...) //nolint:staticcheck // TODO WaitInspectWithArgs is deprecated.
assert.NilError(c, err, "test1 should exit but not")
// make sure test1 isn't restarted when daemon restart

View File

@@ -247,6 +247,7 @@ func appendBaseEnv(isTLS bool, env ...string) []string {
// waitInspect will wait for the specified container to have the specified string
// in the inspect output. It will wait until the specified timeout (in seconds)
// is reached.
//
// Deprecated: use cli.WaitFor
func waitInspect(name, expr, expected string, timeout time.Duration) error {
return daemon.WaitInspectWithArgs(dockerBinary, name, expr, expected, timeout)