Skip to content

🌱 (chore): avoid shadowing of 'err' in CLI options, YAML store, and external plugin helpers #4658

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/cli/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func getPluginsRoot(host string) (pluginsRoot string, err error) {
// if user provides specific path, return
if pluginsPath := os.Getenv("EXTERNAL_PLUGINS_PATH"); pluginsPath != "" {
// verify if the path actually exists
if _, err := os.Stat(pluginsPath); err != nil {
if _, err = os.Stat(pluginsPath); err != nil {
if os.IsNotExist(err) {
// the path does not exist
return "", fmt.Errorf("the specified path %s does not exist", pluginsPath)
Expand Down
2 changes: 1 addition & 1 deletion pkg/config/store/yaml/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (s *yamlStore) LoadFrom(path string) error {

// Check the file version
var versioned versionedConfig
if err := yaml.Unmarshal(in, &versioned); err != nil {
if err = yaml.Unmarshal(in, &versioned); err != nil {
return store.LoadError{Err: fmt.Errorf("unable to determine config version: %w", err)}
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/plugins/external/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func getUniverseMap(fs machinery.Filesystem) (map[string]string, error) {
}

defer func() {
if err := file.Close(); err != nil {
if err = file.Close(); err != nil {
return
}
}()
Expand Down
Loading