You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*What steps will reproduce the problem?*
1. Format http://play.golang.org/p/jzmwwldMwt
2. Format
*What is the expected output?*
{{{
type Field struct {
ID `json:"UID"` // comment
Label ID `json:"Lbl"` // comment
*N // comment
Value string `json:"Val"`
Inheritable `json:"Inh"` // comment
a int // comment
b string
c int // comment
}
}}}
*What do you see instead?*
{{{
type Field struct {
ID `json:"UID"` // comment
Label ID `json:"Lbl"` // comment
*N // comment
Value string `json:"Val"`
Inheritable `json:"Inh"` // comment
a int // comment
b string
c int // comment
}
}}}
*Which version are you using?*
go1.2
I opened a discussion on this here:
https://groups.google.com/d/topic/golang-nuts/5RlC11J7XNE/discussion
It would be great if go fmt would align the parts of field definitions by kind (type,
tag, comment), rather than by index (first parts align, second parts), across contiguous
field definitions until an intermittent newline or comment.
The type of anonymous fields would be regarded as the field name, and would not
contribute to computing the alignment of the types. All types in a contiguous list of
fields would align to the rightmost, and then all tags, and then all comments.
However, this does get tricky: http://play.golang.org/p/Z_OPEbej-v
The text was updated successfully, but these errors were encountered:
agnivade
changed the title
go/printer: wonky alignment of the parts of struct field definitions
go/printer: wonky alignment when mixing embedded and typed fields along with struct tags in a struct definition
May 7, 2018
by cudmore.mb:
The text was updated successfully, but these errors were encountered: