<pre class="notranslate">$ cat incorrect_init.go
package main

var (
    a = p("a") + c + b
    b = p("b") + f()
    c = p("c") + f()
    d = p("d") + 3
)

func f() int {
     d++
     return d
}

func p(s string) int {
     println(s)
     return 0
}

func main() {
    println(a, b, c, d)
}

compiling and executing produces:

$ go run incorrect_init.go
d
c
b
a
9 5 4 5

But the correct order per the spec should be: d, b, c, a, with values 9, 4, 5, 5.

See: <a href="http://tip.golang.org/ref/spec#Package_initialization" rel="nofollow">http://tip.golang.org/ref/spec#Package_initialization</a></pre>
<pre class="notranslate"><a href="http://play.golang.org/p/icbjgkx71B" rel="nofollow">http://play.golang.org/p/icbjgkx71B</a>

got:
gc produces the initialization order: c b a .

want:
The variables b and c are independent of each other, and b is declared before c, so the
order should be: b c a .

gccgo reports the order: b c a .

Based on spec clarification <a href="https://golang.org/cl/99020043" rel="nofollow">https://golang.org/cl/99020043</a> (<a href="https://golang.org/issue/6703" rel="nofollow">issue #6703</a>).</pre>