Skip to content

cmd/compile: unexpected character in for clause causes misleading error #17328

Closed
@0xmohit

Description

@0xmohit

What version of Go are you using (go version)?

go version go1.7.1 linux/amd64

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH=""
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build433231288=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"

What did you do?

https://play.golang.org/p/nALNrCVtmz

What did you expect to see?

Something suggesting that ) was unexpected.

Using go 1.5.3, one would see:

# command-line-arguments
./t.go:5: syntax error: unexpected ), expecting {

What did you see instead?

# command-line-arguments
./t.go:5: syntax error: missing { after for clause

The current error isn't as helpful as it was.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions