$ cat x.go
package main
var x = []int{
1
}
$ gofmt x.go
x.go:4:3: expected '}', found newline
x.go:5:1: expected declaration, found '}'
$
Since this is such a common beginning Go programmer mistake,
go/parser should diagnose it directly, saying something like:
x.go:4:3: missing ',' before newline in composite literal
The text was updated successfully, but these errors were encountered:
See: http://golang.org/cl/5660046
For:
package p
var _ = []int{
1
}
func _() {
f(
1
)
}
The error message are now:
gofmt x.go
x.go:4:3: missing ',' before newline in composite literal
x.go:9:4: missing ',' before newline in argument list
The text was updated successfully, but these errors were encountered: