Here is another example - https://play.golang.org/p/9P-LmSkUMKY
package main
import (
"fmt"
)
func callOut() int {
fmt.Println("Outside is beinge executed")
return 1
}
var test = callOut()
func init() {
fmt.Println("Init3 is being executed")
}
func init() {
fmt.Println("Init is being executed")
}
func init() {
fmt.Println("Init2 is being executed")
}
func main() {
fmt.Println("Do your thing !")
}
Output of the above program
$ go run init/init.go
Outside is being executed
Init3 is being executed
Init is being executed
Init2 is being executed
Do your thing !