I started working with go for a few weeks, and (once again) I stumbled across something that seems odd for me:
// Not working
a := 1
{
a, b := 2, 3
}
//
According to the golang the documentation:
An identifier declared in a block may be redeclared in an inner block.
That's exactly what your example is showing, a is redeclared within the brackets, because of the ':=', and is never used.
A solution is to declare both variable and then use it:
var a, b int
{
b, a = 2, 3
fmt.Println(b)
}
fmt.Println(a)