It seems that the inline spacing/width of tags does not take comments into account.
In the example below, we see that the sql tag is placed 42 characters before the string start. Which looks strange because the fields are not aligned by their name or types due to the comment.
type Example struct {
A string `json:"some-really-really-long-identifier" sql:"-"`
// SomeOtherField
SomeOtherField []int ` sql:"-"`
}
If we were to remove the comment, everything looks nicely aligned.
type Example struct {
A string `json:"some-really-really-long-identifier" sql:"-"`
SomeOtherField []int ` sql:"-"`
}
Likewise if we inserted a blank line before the comment:
type Example struct {
A string `json:"some-really-really-long-identifier" sql:"-"`
// SomeOtherField
SomeOtherField []int `sql:"-"`
}
This is the desired effect:
type Example struct {
A string `json:"some-really-really-long-identifier" sql:"-"`
// SomeOtherField
SomeOtherField []int `sql:"-"`
}
Since names and types are only aligned within groups of non-comment lines I think tags should respect that as well.
It seems that the inline spacing/width of tags does not take comments into account.
In the example below, we see that the
sql
tag is placed 42 characters before the string start. Which looks strange because the fields are not aligned by their name or types due to the comment.If we were to remove the comment, everything looks nicely aligned.
Likewise if we inserted a blank line before the comment:
This is the desired effect:
Since names and types are only aligned within groups of non-comment lines I think tags should respect that as well.