Skip to content
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

cmd/gofmt: align struct tags #11857

Closed
pvinis opened this issue Jul 24, 2015 · 3 comments
Closed

cmd/gofmt: align struct tags #11857

pvinis opened this issue Jul 24, 2015 · 3 comments

Comments

@pvinis
Copy link

pvinis commented Jul 24, 2015

take this struct for example
https://github.com/go-gitea/gitea/blob/master/models/issue.go#L33

why not have all the `` under each other? so instead of having little blocks and some of them are in column 30, some in column 33 etc, why not all be in max column of those blocks, like say column 37?

@mikioh mikioh changed the title gofmt: formatting of `` in structs could be better cmd/gofmt: formatting of `` in structs could be better Jul 24, 2015
@ianlancetaylor ianlancetaylor added this to the Unplanned milestone Jul 24, 2015
@josharian josharian changed the title cmd/gofmt: formatting of `` in structs could be better cmd/gofmt: formatting of tags in structs could be better Jul 24, 2015
@josharian josharian changed the title cmd/gofmt: formatting of tags in structs could be better cmd/gofmt: align struct tags Jul 24, 2015
@griesemer
Copy link
Contributor

They are not aligned because they are not in an uninterrupted column. All the tags across a sequence of lines where each line contains a tag are aligned. As soon as a line doesn't have a tag, the "tag column" is terminated. This is very much the intent and a strategy applied everywhere throughout gofmt (the same applies for comments).

Working as intended.

@pvinis
Copy link
Author

pvinis commented Jul 25, 2015

sure, i understand that. is there a reason why this way was chosen over the way i was describing?

@griesemer
Copy link
Contributor

@pvinis The reason it works as it does is because there was no intent to make it work differently than any other alignment. It's the absence of making a (different) choice.

@golang golang locked and limited conversation to collaborators Aug 5, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants