-
-
Notifications
You must be signed in to change notification settings - Fork 362
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
staticcheck: SA4006 false-negative when nil value used #733
Labels
Comments
Sounds reasonable. |
Thanks @dominikh! 👏 🎉 |
@dominikh Would it be possible to include this in a release? |
@leighmcculloch Sorry for the delays. I'll make a new release as soon as possible. |
dominikh
added a commit
that referenced
this issue
Jul 30, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
staticcheck -version
staticcheck -debug.version
go version
go env
Staticcheck is detecting an explicit
nil
value given to a variable as a value that isn't used.See this simple example, that is a simpler version of the code I experienced this in:
If I change the code to not provide the
nil
value explicitly, staticcheck passes. I believe this is a false positive because there's no value to use, and there's no reason to prefer one syntax over the other. In both cases the same value has been set on the variable and in both cases the nil value does not need to be more used than the other to be correct code.The original error I experienced can be viewed in this CircleCI build and required this work-around to avoid the false positive.
The text was updated successfully, but these errors were encountered: