Skip to content
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

Bug Report: code bug, check err !=nil but return a nil value error e #1961

Open
alingse opened this issue Dec 15, 2024 · 0 comments
Open

Bug Report: code bug, check err !=nil but return a nil value error e #1961

alingse opened this issue Dec 15, 2024 · 0 comments

Comments

@alingse
Copy link

alingse commented Dec 15, 2024

I create a linter to detect code that returns a non-relevant nilness error bug. I checked the top 1000 GitHub Go repositories and found this, all result listed in alingse/sundrylint#4

this project output was this.
https://github.com/alingse/sundrylint/actions/runs/12331397347

providers/okta/app_signon_policy_rule.go#L80 return a error variable but it's nil
providers/okta/authorization_server.go#L54 return a error variable but it's nil
providers/okta/event_hook.go#L48 return a error variable but it's nil
providers/okta/group.go#L50 return a error variable but it's nil
providers/okta/group_rule.go#L48 return a error variable but it's nil
providers/okta/inline_hook.go#L48 return a error variable but it's nil
providers/okta/policy_rule_mfa.go#L80 return a error variable but it's nil
providers/okta/policy_rule_password.go#L80 return a error variable but it's nil
providers/okta/policy_rule_signon.go#L80 return a error variable but it's nil
providers/okta/template_sms.go#L48 return a error variable but it's nil
providers/okta/trusted_origin.go#L48 return a error variable but it's nil
providers/okta/user.go#L48 return a error variable but it's nil
providers/okta/user_type.go#L48 return a error variable but it's nil

It's all one style code

ctx, client, e := g.Client()
	if e != nil {
		return e
	}

	output, err := getAuthorizationServers(ctx, client)
	if err != nil {
		return e // which should be err
	}

the e is already be nil, and return as a error,

🤔, see #1000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant