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

gc: no new variables errors should point at relevant operator #3856

Closed
dsymonds opened this issue Jul 24, 2012 · 5 comments
Closed

gc: no new variables errors should point at relevant operator #3856

dsymonds opened this issue Jul 24, 2012 · 5 comments

Comments

@dsymonds
Copy link
Contributor

For a program like this:
----------
package main

type T struct {
    A int
    B int
}

func main() {
    t := T{}
    t := T{         // line 10
        A: 1,
        B: 2,
    }               // line 13
    
    _ = t
}
----------

The error message is
  prog.go:13: no new variables on left side of :=

The line number in the error should be 10.
@dsymonds
Copy link
Contributor Author

Comment 1:

Owner changed to @dsymonds.

Status changed to Started.

@dsymonds
Copy link
Contributor Author

Comment 2:

Owner changed to @rsc.

Status changed to Accepted.

@DanielMorsing
Copy link
Contributor

Comment 3:

I have a fix for this at http://golang.org/cl/6455056/

@dsymonds
Copy link
Contributor Author

Comment 4:

(daniel.morsing)

Status changed to Started.

@rsc
Copy link
Contributor

rsc commented Jul 30, 2012

Comment 5:

This issue was closed by revision dd166b9.

Status changed to Fixed.

DanielMorsing added a commit that referenced this issue May 11, 2015
…line number.

««« backport 98788e8973f2
cmd/gc: point "no new variables" error at right line number.

Fixes #3856.

R=dsymonds, rsc
CC=golang-dev
https://golang.org/cl/6455056

»»»
@golang golang locked and limited conversation to collaborators Jun 24, 2016
@rsc rsc removed their assignment Jun 22, 2022
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

4 participants