Hi,

Consider this code.

package main

var foo = func (){
    type A struct {}
}

type A struct {}

func (a A) X() {

}

func (a A) Y() {
    a.X()  // go vet complains about this method being non-existant
}

func main() {

}

When I run go vet, I get:

./main.go:13:2: invalid operation: a (variable of type A) has no field or 
method X
vet: typecheck failures

But when I run go run. No errors being reported. Compiler does not complain.

I think the struct I define inside the function (at the top), is evaluated 
by go vet at the global scope somehow. Thus causing the mixup with the 
struct that I've defined at the bottom, which is in the global scope.

What do you think? Should I file a bug about this?

Regards,

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to