Summary
The changes from v0.3.19 and GH-287 resulted in numerous CI "failures" across projects that I maintain. Many of the complaints were solved by struct field reordering, but some issues persisted even after hours spent trying to align the fields per various guides. After spending far too long on this, I opened an upstream report with an example to reproduce the problem: golang/go#45541.
I learned that the issue had already been reported and responded to in golang/go#44877 (comment). That issue appears to have been closed without documentation changes, including how to disable that specific linting check.
From what I now understand, the fieldalignment linter bundles two diagnostics:
- struct size
- due to inefficient struct field alignment
- pointer bytes
- how many bytes of the object that the garbage collector (GC) has to potentially scan for pointers
For the second, the Go team member who maintained the now deprecated maligned linter indicated that it's not worth reporting to users by default; I've yet to find a way to selectively disable this diagnostic and golangci/golangci-lint#1825 was closed without resolution.
For now, I'm not sure whether it's worth reverting GH-287 or waiting to see what upstream and golangci-lint devs do to help mute the "pointer bytes" warnings. I'm learning towards reverting GH-287 for now.
References
Summary
The changes from v0.3.19 and GH-287 resulted in numerous CI "failures" across projects that I maintain. Many of the complaints were solved by struct field reordering, but some issues persisted even after hours spent trying to align the fields per various guides. After spending far too long on this, I opened an upstream report with an example to reproduce the problem: golang/go#45541.
I learned that the issue had already been reported and responded to in golang/go#44877 (comment). That issue appears to have been closed without documentation changes, including how to disable that specific linting check.
From what I now understand, the
fieldalignmentlinter bundles two diagnostics:For the second, the Go team member who maintained the now deprecated
malignedlinter indicated that it's not worth reporting to users by default; I've yet to find a way to selectively disable this diagnostic and golangci/golangci-lint#1825 was closed without resolution.For now, I'm not sure whether it's worth reverting GH-287 or waiting to see what upstream and golangci-lint devs do to help mute the "pointer bytes" warnings. I'm learning towards reverting GH-287 for now.
References
fieldalignmentas replacement golangci/golangci-lint#1765