<p dir="auto">The compiler issues an error message for a goto jumping over type or const declaration, like</p>
<div class="highlight highlight-source-go notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="package main

func main() {
    goto L1
    type A int
L1:
}"><pre class="notranslate"><span class="pl-k">package</span> main

<span class="pl-k">func</span> <span class="pl-en">main</span>() {
    <span class="pl-k">goto</span> L1
    <span class="pl-k">type</span> <span class="pl-smi">A</span> <span class="pl-smi">int</span>
L1:
}</pre></div>
<p dir="auto">The specification forbids only jumping over variable declarations.</p>
<pre class="notranslate">go version devel +4a839bf01b58 Tue May 20 15:52:08 2014 +1000 + linux/amd64

The program is:
package main
func main() {
    goto label
    type X int
    label:
}

$ go build goto.go
goto.go:3: goto label jumps over declaration of X at goto.go:4

The spec only requires new variables to not come into scope:
"Executing the "goto" statement must not cause any variables to come into
scope that were not already in scope at the point of the goto".</pre>