<pre class="notranslate"><a href="http://play.golang.org/p/kSqOMI9a_6" rel="nofollow">http://play.golang.org/p/kSqOMI9a_6</a>

Expected output:

prog.go:4: s declared and not used

But the compiler is silent.

This is an implementation restriction, and a compiler may be free to restrict or not.
That said, given the specification of the restriction, this is not consistent with the
usage checks that gc already does.

We may not be able to fix this since it may invalidate code that is now compiling.</pre>
<p dir="auto">by <strong><a href="mailto:vincent@callanan.ie">vincent@callanan.ie</a></strong>:</p>
<pre class="notranslate">This is a feature request to pre-empt a common programming bug.

It is quite easy to inadvertently use the shorthand assignment operator (:=) inside a
function to assign to a global variable. This creates a separate local variable with the
same name and, in certain scenarios, the effects of this bug can be quite subtle. 

In the interests of code quality -- and given the general aversion to compiler warnings
-- perhaps explicit var declarations should be required for a local variable that shares
the same name as a global variables.</pre>