-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/gofmt: call("arg", newline /* comment */) is changed to syntax error #27574
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
/cc @griesemer |
Seems like a valid bug to me. Any reason this needs to be 'NeedsDecision' ? |
@agnivade No reason other than me misunderstanding the labels, it seems. |
The related code is in package
Test cases: package main
func issue27574a() {
print("",
/**/)
}
func issue27574b() {
print(`
`,
/**/)
}
func issue27574c() {
print(
"",
/**/)
}
func issue27574d() {
print(
"",
/**/)
}
func issue27574e() {
print("", "",
/**/)
} |
Too late for 1.12 |
Now gofmt rejects the input. Is this fixed or maybe a new one?
|
Maybe gofmt got more careful not to destroy valid code by validating that the reformatted code still compiles, before actually writing the reformatted code to a file. |
What version of Go are you using (
go version
)?go version go1.10.3 windows/amd64
Does this issue reproduce with the latest release?
Yes, see https://play.golang.org/p/Gv-AmNeMSdT
What did you do?
Open https://play.golang.org/p/Gv-AmNeMSdT, click Format.
What did you expect to see?
After formatting, the program still compiles.
What did you see instead?
Gofmt removes the comma, leading to a syntax error:
The text was updated successfully, but these errors were encountered: