-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/gofmt: formatting change between go1.13.8 and go1.14, unknown if intentional or not #37639
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
Comments
Thanks for reporting. I can reproduce this. I'll copy what's written at https://pkg.go.dev/go/format:
That said, we should indeed confirm whether this was an intentional change in Go 1.14 or not. I'll apply NeedsInvestigation label to do that work. /cc @griesemer |
I'll point out that formatting the input file with Go 1.14 produces an output that is gofmt-compatible with previous versions of Go (1.13.x and 1.12.x). (If it hadn't, that would make it very obvious that the change is unintentional.) |
Thanks. I should clarify that this isn't a problem for us apart from having to reformat a handful of places in our code base where this pattern occurs. I just wanted to bring this up in case it wasn't intentional. |
Thanks for making that clear, and for reporting this! |
I've investigated this. This is caused by CL 188818, which was an intentional change in order to fix issue #28082. /cc @eliben @mvdan The single-line Closing since Thanks again for reporting this issue @kevinconaway! |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
After upgrading to go 1.14, we noticed that
go fmt
was reformatting some of our files that previously had not changed under go 1.13 and earlier versions.I didn't see anything related to fmt in the release notes, is this behavior expected?
Below is a sample file that shows the issue
Run
go fmt
on the following fileWhat did you expect to see?
No change in formatting
What did you see instead?
The formatting was was reformatted to
The text was updated successfully, but these errors were encountered: