Browse Source

golangci-lint: enable dupword linter

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 1 year ago
parent
commit
f5a5e3f203

+ 6 - 0
.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

+ 3 - 3
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)))
 	}

+ 1 - 1
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,

+ 2 - 2
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()
 }