"go/parser.ParseDir" is not returning an error at parsing files with a keyword
re-declared.
Note: this possible bug also could happens in "parser.ParseFile".
* * *
+ File: foo.go
***
package main
import (
"go/parser"
"go/token"
"log"
)
func main() {
fset := token.NewFileSet()
_, err := parser.ParseDir(fset, "data", nil, parser.ParseComments|parser.DeclarationErrors)
if err != nil {
log.Fatal(err)
}
}
***
+ File: data/a.go
***
package main
func Foo() {}
***
+ File: data/b.go
***
package main
func Foo() {}
***
* * *
However, if you try to use the "go tool" build it, it will return such error:
data$ go build
./b.go:3: Foo redeclared in this block
previous declaration at ./a.go:3
* * *
go version go1.2.1 linux/amd64
The text was updated successfully, but these errors were encountered:
by raul.san@sent.com:
The text was updated successfully, but these errors were encountered: