-
Notifications
You must be signed in to change notification settings - Fork 18k
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/compile: broken := operator generates bizarre error #19440
Comments
@StScAllen PS: You can wrap multiple lines of code in triple backticks so it is rendered in a monospaced font. |
Can be closed because of a non issue. |
Why was this closed? The OP is reporting the fact that the error message that you get when you mis-type ":=" as ": =" is misleading. That's a valid complaint. Also, I remember reading a similar issue in the past (about misleading errors related to |
Ah, it was #17328. The typo is different, but the misleading message was the same: a not-very-informative "missing { after for clause". |
On tip, the error message is:
a little better (at least it mentions Leaving for someone else to decide if improving the reported error for a broken |
@ALTree You're right I overlooked this sentence:
|
I'll take a look - it's not hard to recognize this case, but it's unclear it's worth it. The better thing might be to print column/offset information in error messages (we do have that information now), as it would point much more clearly at the place where the error occurred (rather than just mentioning a line). |
What's a column? |
I think with column he means the index/position in the line. |
For more arguing about columns: #10324 (comment). :^) |
At tip, the error reported is:
which is pretty clear. That is, this has been fixed as part of another issue.
pin-pointing the offending token exactly. Once 1.9 is out, the playground will behave the same. Closing as there's nothing else to do here. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.7.3 windows/amd64
What operating system and processor architecture are you using (
go env
)?set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\GoWork;C:\GoWork\src\github.com\user\character
set GORACE=
set GOROOT=C:\Go
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\all
st\AppData\Local\Temp\go-build641294366=/tmp/go-build -gno-record-gcc-switches
set CXX=g++
set CGO_ENABLED=1
What did you do?
https://play.golang.org/p/Nk92HWr1YX
For loop generates error that opening { brace is missing. Rather than
informing user the := operator is severed.
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
What did you expect to see?
unexpected token ':' on line 7
(or something like that)
Really anything but the missing { comment, as the brackets are all correct.
What did you see instead?
syntax error: missing { after for clause
The text was updated successfully, but these errors were encountered: