Skip to content

Commit

Permalink
Fix nolint issues
Browse files Browse the repository at this point in the history
Reference -> https://golangci-lint.run/usage/false-positives/#nolint-directive

Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
  • Loading branch information
ulyssessouza committed Jul 13, 2022
1 parent 914b1d6 commit 906106b
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 10 deletions.
8 changes: 4 additions & 4 deletions cli/options_test.go
Expand Up @@ -121,8 +121,8 @@ func TestProjectName(t *testing.T) {
})

t.Run("by COMPOSE_PROJECT_NAME", func(t *testing.T) {
os.Setenv("COMPOSE_PROJECT_NAME", "my_project_from_env") //nolint:errcheck
defer os.Unsetenv("COMPOSE_PROJECT_NAME") //nolint:errcheck
os.Setenv("COMPOSE_PROJECT_NAME", "my_project_from_env")
defer os.Unsetenv("COMPOSE_PROJECT_NAME")
opts, err := NewProjectOptions([]string{"testdata/simple/compose.yaml"}, WithOsEnv)
assert.NilError(t, err)
p, err := ProjectFromOptions(opts)
Expand All @@ -135,7 +135,7 @@ func TestProjectName(t *testing.T) {
assert.NilError(t, err)
err = os.Chdir("testdata/env-file")
assert.NilError(t, err)
defer os.Chdir(wd) //nolint:errcheck
defer os.Chdir(wd)

opts, err := NewProjectOptions(nil, WithDotEnv, WithConfigFileEnv)
assert.NilError(t, err)
Expand Down Expand Up @@ -192,7 +192,7 @@ func TestProjectWithDotEnv(t *testing.T) {
assert.NilError(t, err)
err = os.Chdir("testdata/simple")
assert.NilError(t, err)
defer os.Chdir(wd) //nolint:errcheck
defer os.Chdir(wd)

opts, err := NewProjectOptions([]string{
"compose-with-variables.yaml",
Expand Down
2 changes: 1 addition & 1 deletion dotenv/godotenv.go
Expand Up @@ -183,7 +183,7 @@ func Marshal(envMap map[string]string) (string, error) {
if d, err := strconv.Atoi(v); err == nil {
lines = append(lines, fmt.Sprintf(`%s=%d`, k, d))
} else {
lines = append(lines, fmt.Sprintf(`%s="%s"`, k, doubleQuoteEscape(v))) // nolint Cannot use %q here
lines = append(lines, fmt.Sprintf(`%s="%s"`, k, doubleQuoteEscape(v))) //nolint // Cannot use %q here
}
}
sort.Strings(lines)
Expand Down
1 change: 0 additions & 1 deletion golangci.yml
Expand Up @@ -23,4 +23,3 @@ linters-settings:
disabled-checks:
- paramTypeCombine
- unnamedResult
- whyNoLint
2 changes: 1 addition & 1 deletion loader/loader.go
Expand Up @@ -637,7 +637,7 @@ func resolveEnvironment(serviceConfig *types.ServiceConfig, workingDir string, l
}

// Do not defer to avoid it inside a loop
file.Close() // nolint:errcheck
file.Close() //nolint:errcheck // Nothing to do...

fileVars, err := dotenv.ParseWithLookup(bytes.NewBuffer(b), dotenv.LookupFn(lookupEnv))
if err != nil {
Expand Down
2 changes: 0 additions & 2 deletions loader/merge.go
Expand Up @@ -299,15 +299,13 @@ 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())
}
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"))
Expand Down
1 change: 0 additions & 1 deletion loader/windows_path.go
Expand Up @@ -44,7 +44,6 @@ func isAbs(path string) (b bool) {

// volumeNameLen returns length of the leading volume name on Windows.
// It returns 0 elsewhere.
// nolint: gocyclo
func volumeNameLen(path string) int {
if len(path) < 2 {
return 0
Expand Down

0 comments on commit 906106b

Please sign in to comment.