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
go/parser: wrong syntax error #2088
Labels
Comments
This issue is fixed with (pending) CL 4803047 ( http://golang.org/cl/4803047 ). By default, the parser, gofmt, and gotype report at most one error per line as often subsequent errors on a line are spurious follow-up errors. In this case, the parser guesses the label declaration to start at the x and reports it as such but does not report the erroneous % (because it's considered a spurious error). Changed the label error reporting to use the '%' position instead. Now the first error reported is for the '%': gofmt test.go test.go:4:7: expected operand, found '%' test.go:5:2: expected '}', found 'EOF' Also added a -e flag to gotype and gofmt to get all errors: gofmt -e test.go test.go:4:7: expected operand, found '%' test.go:4:8: expected ')', found 'IDENT' v test.go:4:9: illegal label declaration test.go:4:11: expected ';', found 'IDENT' hi test.go:4:13: string not terminated test.go:5:2: expected '}', found 'EOF' test.go:5:2: expected ';', found 'EOF' The scanner always checked for newlines in strings (again, in this specific case that error is only reported with the -e flag set). |
This issue was closed by revision fa49779. Status changed to Fixed. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: