Re: [go-nuts] "go vet -shadow" and named return variable

2018-10-01 Thread Pierre Durand
ok, thank you ! Le lundi 1 octobre 2018 19:31:58 UTC+2, Ian Lance Taylor a écrit : > > On Mon, Oct 1, 2018 at 7:56 AM, Pierre Durand > wrote: > > > > My code: > > package main > > > > func main() { > > a := 1 > > _ = func() { > > a := 2 > > _ = a > > } > > _ = func() (a int) { > > a

Re: [go-nuts] "go vet -shadow" and named return variable

2018-10-01 Thread Ian Lance Taylor
On Mon, Oct 1, 2018 at 7:56 AM, Pierre Durand wrote: > > My code: > package main > > func main() { > a := 1 > _ = func() { > a := 2 > _ = a > } > _ = func() (a int) { > a = 2 > return a > } > _ = a > } > > "go vet -shadow" reports a problem with the first function/closure, but > nothing for the

[go-nuts] "go vet -shadow" and named return variable

2018-10-01 Thread Pierre Durand
My code: package main func main() { a := 1 _ = func() { a := 2 _ = a } _ = func() (a int) { a = 2 return a } _ = a } "go vet -shadow" reports a problem with the first function/closure, but nothing for the second one. Why ? If I understand correctly, it doesn't consider variable declaration in