Skip to content

Commit 58a7c31

Browse files
vvolandthaJeztah
authored andcommitted
golangci-lint: fix lint failures from v2.10.1 upgrade
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
1 parent f37a9e6 commit 58a7c31

3 files changed

Lines changed: 12 additions & 5 deletions

File tree

.golangci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,15 @@ linters:
110110
excludes:
111111
- G104 # G104: Errors unhandled; (TODO: reduce unhandled errors, or explicitly ignore)
112112
- G115 # G115: integer overflow conversion; (TODO: verify these: https://github.com/docker/cli/issues/5584)
113+
- G117 # G117: Exported struct field matches secret pattern (false positives for legitimate field names)
114+
- G118 # G118: Goroutine uses context.Background/TODO while request-scoped context is available (TODO: evaluate these)
115+
- G122 # G122: Filesystem operation in filepath.Walk/WalkDir callback uses race-prone path (TODO: evaluate these)
113116
- G306 # G306: Expect WriteFile permissions to be 0600 or less (too restrictive; also flags "0o644" permissions)
114117
- 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")
118+
- G702 # G702: Command injection via taint analysis (TODO: evaluate these)
119+
- G703 # G703: Path traversal via taint analysis (TODO: evaluate these)
120+
- G704 # G704: SSRF via taint analysis (TODO: evaluate these)
121+
- G705 # G705: XSS via taint analysis (TODO: evaluate these)
115122

116123
govet:
117124
enable:

cli-plugins/manager/manager_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,8 @@ func TestGetPluginDirs(t *testing.T) {
177177
pluginDirs := getPluginDirs(cli.ConfigFile())
178178
assert.Equal(t, strings.Join(expected, ":"), strings.Join(pluginDirs, ":"))
179179

180-
extras := []string{
181-
"foo", "bar", "baz",
182-
}
180+
extras := make([]string, 0, 3+len(expected))
181+
extras = append(extras, "foo", "bar", "baz")
183182
expected = append(extras, expected...)
184183
cli.SetConfigFile(&configfile.ConfigFile{
185184
CLIPluginsExtraDirs: extras,

cli/command/cli.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -566,11 +566,12 @@ type ServerInfo struct {
566566
// It applies by default the standard streams, and the content trust from
567567
// environment.
568568
func NewDockerCli(ops ...CLIOption) (*DockerCli, error) {
569-
defaultOps := []CLIOption{
569+
defaultOps := make([]CLIOption, 0, 3+len(ops))
570+
defaultOps = append(defaultOps,
570571
WithDefaultContextStoreConfig(),
571572
WithStandardStreams(),
572573
WithUserAgent(UserAgent()),
573-
}
574+
)
574575
ops = append(defaultOps, ops...)
575576

576577
cli := &DockerCli{baseCtx: context.Background()}

0 commit comments

Comments
 (0)