From f5a5e3f203dee1bfe7d37cac0913f0cea9562915 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 6 Mar 2024 15:15:24 +0100 Subject: [PATCH] golangci-lint: enable dupword linter Signed-off-by: Sebastiaan van Stijn --- .golangci.yml | 6 ++++++ integration-cli/docker_cli_service_logs_test.go | 6 +++--- integration/image/remove_unix_test.go | 2 +- libnetwork/drivers/overlay/ov_network.go | 4 ++-- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 160d88a679..15f7e743a2 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,6 +1,7 @@ linters: enable: - depguard + - dupword # Checks for duplicate words in the source code. - goimports - gosec - gosimple @@ -25,6 +26,11 @@ linters: - docs linters-settings: + dupword: + ignore: + - "true" # some tests use this as expected output + - "false" # some tests use this as expected output + - "root" # for tests using "ls" output with files owned by "root:root" importas: # Do not allow unaliased imports of aliased packages. no-unaliased: true diff --git a/integration-cli/docker_cli_service_logs_test.go b/integration-cli/docker_cli_service_logs_test.go index f4d549ce05..6cbe127bbf 100644 --- a/integration-cli/docker_cli_service_logs_test.go +++ b/integration-cli/docker_cli_service_logs_test.go @@ -90,9 +90,9 @@ func (s *DockerSwarmSuite) TestServiceLogsCompleteness(c *testing.T) { assert.NilError(c, err) lines := strings.Split(strings.TrimSpace(out), "\n") - // i have heard anecdotal reports that logs may come back from the engine - // mis-ordered. if this tests fails, consider the possibility that - // might be occurring + // I have heard anecdotal reports that logs may come back from the engine + // mis-ordered. If this test fails, then possibly that's what causing the + // failure. for i, line := range lines { assert.Assert(c, strings.Contains(line, fmt.Sprintf("log test %v", i))) } diff --git a/integration/image/remove_unix_test.go b/integration/image/remove_unix_test.go index 92cbc13b1e..01b3072eed 100644 --- a/integration/image/remove_unix_test.go +++ b/integration/image/remove_unix_test.go @@ -63,7 +63,7 @@ func TestRemoveImageGarbageCollector(t *testing.T) { // Build a image with multiple layers dockerfile := `FROM busybox - RUN echo 'echo Running...'' > /run.sh` + RUN echo 'echo Running...' > /run.sh` source := fakecontext.New(t, "", fakecontext.WithDockerfile(dockerfile)) defer source.Close() resp, err := client.ImageBuild(ctx, diff --git a/libnetwork/drivers/overlay/ov_network.go b/libnetwork/drivers/overlay/ov_network.go index 66d4a44ed6..6dcf3ec37c 100644 --- a/libnetwork/drivers/overlay/ov_network.go +++ b/libnetwork/drivers/overlay/ov_network.go @@ -64,8 +64,8 @@ func init() { // Lock main() to the initial thread to exclude the goroutines executing // func setDefaultVLAN() from being scheduled onto that thread. Changes to // the network namespace of the initial thread alter /proc/self/ns/net, - // which would break any code which (incorrectly) assumes that the file is - // a handle to the network namespace for the thread it is currently + // which would break any code which (incorrectly) assumes that /proc/self/ns/net + // is a handle to the network namespace for the thread it is currently // executing on. runtime.LockOSThread() }