-
Notifications
You must be signed in to change notification settings - Fork 285
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 with var-declaration #1152
Labels
Comments
Hi @rliebz thanks for reporting the problem. I'll take a look |
@chavacava can you please check my PR? |
Yes, no problem but please in the future assign you the issue before start working on it. |
@chavacava yeah, sorry, missed that. |
@rliebz please check with my updates merged. |
Confirmed fixed, thanks for the quick response time! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
The
var-declaration
check incorrectly warns if explicitly assigning a zero value in avar
declaration, even if the zero value being assigned isn't the default for a variable of that type.To Reproduce
Steps to reproduce the behavior:
go install github.com/mgechev/revive@latest
main.go:
Expected behavior
I would expect no errors for
var-declaration
, because the zero value for a variable of typeany
isnil
, not0
or""
.Logs
Desktop (please complete the following information):
go version go1.23.3 darwin/arm64
Additional context
N/A
The text was updated successfully, but these errors were encountered: