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
On some bad code, gofmt gives a confusing error while the compiler gives a nice one.
Online demo at http://play.golang.org/p/htmZpN6HcY (click "format"), also inlined here to keep the bug self-contained.
package main import "fmt" func main() { x := struct { foo string, }{3} }
The issue is the comma.
Format says 6:7: expected expression (and 3 more errors), which points at the "struct" keyword.
6:7: expected expression (and 3 more errors)
Run says prog.go:7: syntax error: unexpected comma, expecting }, which is a good error message.
prog.go:7: syntax error: unexpected comma, expecting }
The text was updated successfully, but these errors were encountered:
CL https://golang.org/cl/14564 mentions this issue.
Sorry, something went wrong.
8fab292
No branches or pull requests
On some bad code, gofmt gives a confusing error while the compiler gives a nice one.
Online demo at http://play.golang.org/p/htmZpN6HcY (click "format"), also inlined here to keep the bug self-contained.
The issue is the comma.
Format says
6:7: expected expression (and 3 more errors)
, which points at the "struct" keyword.Run says
prog.go:7: syntax error: unexpected comma, expecting }
, which is a good error message.The text was updated successfully, but these errors were encountered: