I’m using golang.org/x/tools/go/analysis/passes/fieldalignment/cmd/fieldalignment
for field alignment and I’m having very bad moments reading my structs because I have this:
type Player struct {
createdAt time.Time
team *Team
pumID *uint64
Sponsorship
description string
teamID uint64
projectID uint64
categoryID uint64
authorID uint64
id uint64
}
instead for example of this:
type Player struct {
id uint64
createdAt time.Time
description string
authorID uint64
categoryID uint64
projectID uint64
pumID *uint64
teamID uint64
team *Team
Sponsorship
}
which is faster and clearer to read and understand for me.
PROPOSAL
Can we have some sort of build flag at compile time to apply fieldalignment
on each struct in our project?
Something like:
go build --fieldalignment .
It would be very welcome and simple to realize I think.
Sorry if I wrote the proposal wrong.