Using := assignment on a struct field gives a helpful message from gc, but less helpful
from gofmt.
From gc: prog.go:12: non-name t.a on left side of :=
From gofmt: prog.go:12:2: expected identifier
http://play.golang.org/p/Ajrytiavn_
--------------------
package main
import "fmt"
type T struct {
a int
b int
}
func main() {
var t T
t.a := 7 // here is the error
fmt.Println(t)
}
The text was updated successfully, but these errors were encountered:
I agree that go/parser should do a better job here. It's especially important since so
many tools parse the Go code with go/parser before passing it to gc.
The text was updated successfully, but these errors were encountered: