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

False positive for functions in map #82

Open
mholt opened this issue Aug 29, 2024 · 0 comments
Open

False positive for functions in map #82

mholt opened this issue Aug 29, 2024 · 0 comments

Comments

@mholt
Copy link

mholt commented Aug 29, 2024

var cmdMap = map[string]func() error{
	"cmd1": func() error { // OK
		return errors.New("foo")
	},
	"cmd2": func() error { // false positive
		return nil
	},
}

In this code, I think it's pretty clear cmd2 needs to have an error return because the signature of the map value mandates it, but it gets flagged as "result 0 (error) is always nil".

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