On Wed, May 2, 2018 at 4:34 AM, Mustafa Arici <cadtheco...@gmail.com> wrote: > > 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?
Thanks for the report. I believe that this has already been fixed on tip, and the fix will be in the future 1.11 release. I'm guessing that the fix was https://golang.org/cl/96376 . Ian -- 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.