-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
govet fieldalignment produces false positives for embedded structures #1825
Comments
Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors. |
As per golang/go#44877 (comment) it seems that "pointer bytes" reports from fieldalignment linter correspond to GC scanning the structure rather than structure size. Latter has messages in form of "struct of size X could be Y", and former are "struct with X pointer bytes could be Y", which was pretty confusing. As suggested in linked comment, maybe it is worth ignoring reports of pointer bytes by default in golangci-lint, maybe add an option to handle this. |
The issue seems to be rooted in that maligned used in golangci-lint's go.mod is of pretty old version (as of 2018), while GC pointer scan diagnostic was added there 6 months ago. Naturally, this diagnostic was also introduced to fieldalignment too, but it is a noticable change of behavior when trying to use fieldalignment as drop-in replacement to old maligned version which had no such diagnostic in golangci-lint case. |
Thank you @iamtakingiteasy for the details behind the We can close the issue now. |
Apologies if this was spelled out, but if users enable the govet |
Description of the problem
govet's fieldalignment produces false positives for embedded structures. maligned has no such issue, running
go vet
also does not report same thing.Version of golangci-lint
Config file
Go environment
Verbose output of running
Code example or link to a public repository
The text was updated successfully, but these errors were encountered: