Some people strongly recommend always including `-shadow` when running `go 
vet`.

Using your example:

   $ go vet -shadow
   # example
   .\main.go:20: declaration of "p" shadows declaration at .\main.go:15

--thepudds

On Thursday, September 13, 2018 at 9:54:05 AM UTC-4, Jan Mercl wrote:
>
> On Thu, Sep 13, 2018 at 3:42 PM <goblue...@gmail.com <javascript:>> wrote:
>
> > Why Go accepts to have différents variables with the same name ? Is 
> there any good reasons ?
>
> Because Go is a block scoped language like C and others: 
> https://en.wikipedia.org/wiki/Scope_(computer_science)#Block_scope
>
>
> -- 
>
> -j
>

-- 
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