golangci-lint: enable dupword linter

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2024-03-06 15:15:24 +01:00
parent 4adc40ac40
commit f5a5e3f203
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
4 changed files with 12 additions and 6 deletions

View file

@ -1,6 +1,7 @@
linters: linters:
enable: enable:
- depguard - depguard
- dupword # Checks for duplicate words in the source code.
- goimports - goimports
- gosec - gosec
- gosimple - gosimple
@ -25,6 +26,11 @@ linters:
- docs - docs
linters-settings: 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: importas:
# Do not allow unaliased imports of aliased packages. # Do not allow unaliased imports of aliased packages.
no-unaliased: true no-unaliased: true

View file

@ -90,9 +90,9 @@ func (s *DockerSwarmSuite) TestServiceLogsCompleteness(c *testing.T) {
assert.NilError(c, err) assert.NilError(c, err)
lines := strings.Split(strings.TrimSpace(out), "\n") lines := strings.Split(strings.TrimSpace(out), "\n")
// i have heard anecdotal reports that logs may come back from the engine // I have heard anecdotal reports that logs may come back from the engine
// mis-ordered. if this tests fails, consider the possibility that // mis-ordered. If this test fails, then possibly that's what causing the
// might be occurring // failure.
for i, line := range lines { for i, line := range lines {
assert.Assert(c, strings.Contains(line, fmt.Sprintf("log test %v", i))) assert.Assert(c, strings.Contains(line, fmt.Sprintf("log test %v", i)))
} }

View file

@ -63,7 +63,7 @@ func TestRemoveImageGarbageCollector(t *testing.T) {
// Build a image with multiple layers // Build a image with multiple layers
dockerfile := `FROM busybox dockerfile := `FROM busybox
RUN echo 'echo Running...'' > /run.sh` RUN echo 'echo Running...' > /run.sh`
source := fakecontext.New(t, "", fakecontext.WithDockerfile(dockerfile)) source := fakecontext.New(t, "", fakecontext.WithDockerfile(dockerfile))
defer source.Close() defer source.Close()
resp, err := client.ImageBuild(ctx, resp, err := client.ImageBuild(ctx,

View file

@ -64,8 +64,8 @@ func init() {
// Lock main() to the initial thread to exclude the goroutines executing // Lock main() to the initial thread to exclude the goroutines executing
// func setDefaultVLAN() from being scheduled onto that thread. Changes to // func setDefaultVLAN() from being scheduled onto that thread. Changes to
// the network namespace of the initial thread alter /proc/self/ns/net, // the network namespace of the initial thread alter /proc/self/ns/net,
// which would break any code which (incorrectly) assumes that the file is // which would break any code which (incorrectly) assumes that /proc/self/ns/net
// a handle to the network namespace for the thread it is currently // is a handle to the network namespace for the thread it is currently
// executing on. // executing on.
runtime.LockOSThread() runtime.LockOSThread()
} }