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: strange alignment format #8685

Closed
dlintw opened this issue Sep 9, 2014 · 5 comments
Closed

cmd/gofmt: strange alignment format #8685

dlintw opened this issue Sep 9, 2014 · 5 comments
Assignees
Milestone

Comments

@dlintw
Copy link

@dlintw dlintw commented Sep 9, 2014

http://play.golang.org/p/91rBO_5QBD

go 1.3.1

What steps reproduce the problem?
If possible, include a link to a program on play.golang.org.

1. gofmt
2. strange alignment of map[int]string.

What happened?

var season1 = map[int]string{1: "spring", 2: "summer",
                    3:             "autumn", 4: "winter"}
var season2 = map[string]string{"a": "spring", "b":
"summer",
    "c": "autumn", "d": "winter"}


What should have happened instead?

var season1 = map[int]string{1: "spring", 2: "summer",
        3: "autumn", 4: "winter"}

Please provide any additional information below.
@bradfitz
Copy link
Contributor

@bradfitz bradfitz commented Sep 9, 2014

Comment 1:

Owner changed to @griesemer.

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Sep 9, 2014

Comment 2:

Labels changed: added repo-tools, release-none.

@griesemer
Copy link
Contributor

@griesemer griesemer commented Sep 9, 2014

Comment 3:

Labels changed: added repo-main, release-go1.4, removed repo-tools, release-none.

Status changed to Accepted.

@gopherbot
Copy link

@gopherbot gopherbot commented Sep 9, 2014

Comment 4:

CL https://golang.org/cl/139430043 mentions this issue.
@griesemer
Copy link
Contributor

@griesemer griesemer commented Sep 11, 2014

Comment 5:

This issue was closed by revision 724fa12.

Status changed to Fixed.

@dlintw dlintw added fixed labels Sep 11, 2014
@rsc rsc added this to the Go1.4 milestone Apr 14, 2015
@rsc rsc removed the release-go1.4 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
wheatman added a commit to wheatman/go-akaros that referenced this issue Jun 25, 2018
Details: Until now, when we saw a key:value pair that fit onto
a single line, we assumed that it should be formatted with a
vtab after the ':' for alignment of its value. This leads to
odd behavior if there are more than one such pair on a line.
This CL changes the behavior such that alignment is only used
for the first pair on a line. This preserves existing behavior
(in the std lib we have composite literals where the last line
contains multiple entries and the first entry's value is aligned
with the values on previous lines), and resolves this issue.

No impact on formatting of std lib, go.tools, go.exp, go.net.

Fixes golang#8685.

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/139430043
wheatman added a commit to wheatman/go-akaros that referenced this issue Jul 9, 2018
Details: Until now, when we saw a key:value pair that fit onto
a single line, we assumed that it should be formatted with a
vtab after the ':' for alignment of its value. This leads to
odd behavior if there are more than one such pair on a line.
This CL changes the behavior such that alignment is only used
for the first pair on a line. This preserves existing behavior
(in the std lib we have composite literals where the last line
contains multiple entries and the first entry's value is aligned
with the values on previous lines), and resolves this issue.

No impact on formatting of std lib, go.tools, go.exp, go.net.

Fixes golang#8685.

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/139430043
wheatman added a commit to wheatman/go-akaros that referenced this issue Jul 30, 2018
Details: Until now, when we saw a key:value pair that fit onto
a single line, we assumed that it should be formatted with a
vtab after the ':' for alignment of its value. This leads to
odd behavior if there are more than one such pair on a line.
This CL changes the behavior such that alignment is only used
for the first pair on a line. This preserves existing behavior
(in the std lib we have composite literals where the last line
contains multiple entries and the first entry's value is aligned
with the values on previous lines), and resolves this issue.

No impact on formatting of std lib, go.tools, go.exp, go.net.

Fixes golang#8685.

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/139430043
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants
You can’t perform that action at this time.