<p dir="auto"><a href="https://play.golang.org/p/rEXm1QaLgo" rel="nofollow">https://play.golang.org/p/rEXm1QaLgo</a> prints</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="false
true"><pre class="notranslate"><code class="notranslate">false
true
</code></pre></div>
<p dir="auto">instead of</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="false
false"><pre class="notranslate"><code class="notranslate">false
false
</code></pre></div>
<p dir="auto">This happens both in the playground (currently 1.4) and at tip (1.5) (go version devel +4ec018e Fri Aug 21 13:08:00 2015 -0700 darwin/amd64).</p>
<p dir="auto">I suspect the condition code register gets clobbered or perhaps is not properly saved/restored across function calls.</p>
<p dir="auto">Thanks to Daniel Martí (<a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/mvdan/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/mvdan">@mvdan</a>) for reporting this.</p>
<div class="highlight highlight-source-go notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="var lines = []string{&quot;foo&quot;, &quot;bar&quot;, &quot;baz&quot;}

func main() {
    for _, line := range lines {
        if len(line) == 0 ||
            []byte(line)[0] == []byte(&quot;#&quot;)[0] {
            continue
        }
        fmt.Println(line)
    }
}"><pre class="notranslate"><span class="pl-k">var</span> <span class="pl-s1">lines</span> <span class="pl-c1">=</span> []<span class="pl-smi">string</span>{<span class="pl-s">"foo"</span>, <span class="pl-s">"bar"</span>, <span class="pl-s">"baz"</span>}

<span class="pl-k">func</span> <span class="pl-en">main</span>() {
    <span class="pl-k">for</span> <span class="pl-s1">_</span>, <span class="pl-s1">line</span> <span class="pl-c1">:=</span> <span class="pl-k">range</span> <span class="pl-s1">lines</span> {
        <span class="pl-k">if</span> <span class="pl-en">len</span>(<span class="pl-s1">line</span>) <span class="pl-c1">==</span> <span class="pl-c1">0</span> <span class="pl-c1">||</span>
            []<span class="pl-smi">byte</span>(<span class="pl-s1">line</span>)[<span class="pl-c1">0</span>] <span class="pl-c1">==</span> []<span class="pl-smi">byte</span>(<span class="pl-s">"#"</span>)[<span class="pl-c1">0</span>] {
            <span class="pl-k">continue</span>
        }
        <span class="pl-s1">fmt</span>.<span class="pl-en">Println</span>(<span class="pl-s1">line</span>)
    }
}</pre></div>
<p dir="auto">This snippet of code prints the strings as you would expect when compiled with 1.4, but produces no output when compiled with 1.5.<br>
<a href="http://play.golang.org/p/hR7iVDC-Vu" rel="nofollow">http://play.golang.org/p/hR7iVDC-Vu</a></p>
<p dir="auto">Here's a slightly simpler example of the same bug:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="        s := &quot;foo&quot;
        fmt.Println(len(s)==0 || []byte(s)[0]==[]byte(&quot;#&quot;)[0])"><pre class="notranslate"><code class="notranslate">        s := "foo"
        fmt.Println(len(s)==0 || []byte(s)[0]==[]byte("#")[0])
</code></pre></div>
<p dir="auto">This results in <code class="notranslate">false</code> with 1.4, but <code class="notranslate">true</code> with 1.5.<br>
by taruti in #golang-nuts on irc</p>