From 8f1203743dac16ae6d9059d09123ada115bc6237 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 5 Nov 2026 23:00:46 +0100 Subject: [PATCH] fix linting Signed-off-by: Sebastiaan van Stijn --- .golangci.yml | 10 ---------- cli/command/formatter/container_test.go | 1 + cli/command/service/opts_test.go | 4 ++-- cli/compose/loader/merge.go | 4 ---- internal/registryclient/endpoint.go | 4 ++-- 5 files changed, 5 insertions(+), 18 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 24186a0bef..d89e8a8162 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -201,11 +201,6 @@ linters: linters: - gosec - # TODO: make sure all packages have a description. Currently, there's 67 packages without. - - text: "package-comments: should have a package comment" - linters: - - revive - # Exclude some linters from running on tests files. - path: _test\.go linters: @@ -227,11 +222,6 @@ linters: linters: - staticcheck - # TODO(thaJeztah): remove once https://github.com/leighmcculloch/gocheckcompilerdirectives/issues/7 is fixed. - - text: "compiler directive unrecognized: //go:fix" - linters: - - gocheckcompilerdirectives - # Log a warning if an exclusion rule is unused. # Default: false warn-unused: true diff --git a/cli/command/formatter/container_test.go b/cli/command/formatter/container_test.go index 98e9be4c22..b23db17765 100644 --- a/cli/command/formatter/container_test.go +++ b/cli/command/formatter/container_test.go @@ -276,6 +276,7 @@ func TestContainerPsContext(t *testing.T) { } } +//nolint:dupword // ignore duplicate "ubuntu" in test fixtures func TestContainerContextWrite(t *testing.T) { unixTime := time.Now().AddDate(0, 0, -1).Unix() expectedTime := time.Unix(unixTime, 0).String() diff --git a/cli/command/service/opts_test.go b/cli/command/service/opts_test.go index 5ab11e262b..7c018b1f23 100644 --- a/cli/command/service/opts_test.go +++ b/cli/command/service/opts_test.go @@ -210,9 +210,9 @@ func TestResourceOptionsToResourceRequirementsSwap(t *testing.T) { r, err = swapOptions.ToResourceRequirements(flags) assert.NilError(t, err) assert.Check(t, r.SwapBytes != nil) - assert.Check(t, is.Equal(*(r.SwapBytes), int64(86000))) + assert.Check(t, is.Equal(*r.SwapBytes, int64(86000))) assert.Check(t, r.MemorySwappiness != nil) - assert.Check(t, is.Equal(*(r.MemorySwappiness), int64(23))) + assert.Check(t, is.Equal(*r.MemorySwappiness, int64(23))) } func TestToServiceNetwork(t *testing.T) { diff --git a/cli/compose/loader/merge.go b/cli/compose/loader/merge.go index cf666ab0b2..1130cebe06 100644 --- a/cli/compose/loader/merge.go +++ b/cli/compose/loader/merge.go @@ -255,7 +255,6 @@ func mergeLoggingConfig(dst, src reflect.Value) error { return nil } -//nolint:unparam func mergeUlimitsConfig(dst, src reflect.Value) error { if src.Interface() != reflect.Zero(reflect.TypeOf(src.Interface())).Interface() { dst.Elem().Set(src.Elem()) @@ -263,7 +262,6 @@ func mergeUlimitsConfig(dst, src reflect.Value) error { return nil } -//nolint:unparam func mergeShellCommand(dst, src reflect.Value) error { if src.Len() != 0 { dst.Set(src) @@ -271,7 +269,6 @@ func mergeShellCommand(dst, src reflect.Value) error { return nil } -//nolint:unparam func mergeServiceNetworkConfig(dst, src reflect.Value) error { if src.Interface() != reflect.Zero(reflect.TypeOf(src.Interface())).Interface() { dst.Elem().FieldByName("Aliases").Set(src.Elem().FieldByName("Aliases")) @@ -285,7 +282,6 @@ func mergeServiceNetworkConfig(dst, src reflect.Value) error { return nil } -//nolint:unparam func mergeUint64(dst, src reflect.Value) error { if !src.IsNil() { dst.Elem().Set(src.Elem()) diff --git a/internal/registryclient/endpoint.go b/internal/registryclient/endpoint.go index 6cef45350d..19cfbb6141 100644 --- a/internal/registryclient/endpoint.go +++ b/internal/registryclient/endpoint.go @@ -69,10 +69,10 @@ func getHTTPTransport(authConfig registrytypes.AuthConfig, endpoint registry.API // get the http transport, this will be used in a client to upload manifest base := &http.Transport{ Proxy: http.ProxyFromEnvironment, - Dial: (&net.Dialer{ + DialContext: (&net.Dialer{ Timeout: 30 * time.Second, KeepAlive: 30 * time.Second, - }).Dial, + }).DialContext, TLSHandshakeTimeout: 10 * time.Second, TLSClientConfig: endpoint.TLSConfig, DisableKeepAlives: true,