Skip to content
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/gc: confusing error message for invalid short variable declaration #6764

Closed
griesemer opened this issue Nov 14, 2013 · 7 comments
Closed

Comments

@griesemer
Copy link
Contributor

The compiler reports for following program

http://play.golang.org/p/VnyarNdWXk

prog.go:4: undefined: a
prog.go:4: cannot assign to a

which is confusing. Since there is no redeclaration (a is not defined earlier in the
same block), per the spec, this code is exactly equivalent to:

http://play.golang.org/p/iuTKv5kPq8

and thus should lead to an error more along the lines of:

prog.go:4: a redeclared in this block
    previous declaration at prog.go:4
@rsc
Copy link
Contributor

rsc commented Nov 27, 2013

Comment 1:

Labels changed: added go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 2:

Labels changed: added release-none, removed go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 3:

Labels changed: added repo-main.

@gopherbot
Copy link

Comment 4 by E.Kroske:

I'll take this one.

@griesemer
Copy link
Contributor Author

Comment 5:

See also related issue #8435.

@gopherbot
Copy link

Comment 6:

CL https://golang.org/cl/116440046 mentions this issue.

@rsc
Copy link
Contributor

rsc commented Oct 6, 2014

Comment 7:

This issue was closed by revision 55df81d.

Status changed to Fixed.

@golang golang locked and limited conversation to collaborators Jun 25, 2016
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jun 25, 2018
…bols

Fixes golang#6764.
Fixes golang#8435.

LGTM=rsc
R=golang-codereviews, r, gobot, rsc
CC=golang-codereviews
https://golang.org/cl/116440046
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jun 26, 2018
…bols

Fixes golang#6764.
Fixes golang#8435.

LGTM=rsc
R=golang-codereviews, r, gobot, rsc
CC=golang-codereviews
https://golang.org/cl/116440046
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jul 9, 2018
…bols

Fixes golang#6764.
Fixes golang#8435.

LGTM=rsc
R=golang-codereviews, r, gobot, rsc
CC=golang-codereviews
https://golang.org/cl/116440046
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jul 30, 2018
…bols

Fixes golang#6764.
Fixes golang#8435.

LGTM=rsc
R=golang-codereviews, r, gobot, rsc
CC=golang-codereviews
https://golang.org/cl/116440046
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants