github.com/yanyiwu/go@v0.0.0-20150106053140-03d6637dbb7f/test/fixedbugs/issue5244.go (about)

     1  // run
     2  
     3  // Copyright 2013 The Go Authors. All rights reserved.
     4  // Use of this source code is governed by a BSD-style
     5  // license that can be found in the LICENSE file.
     6  
     7  // Issue 5244: the init order computation uses the wrong
     8  // order for top-level blank identifier assignments.
     9  // The example used to panic because it tries calling a
    10  // nil function instead of assigning to f before.
    11  
    12  package main
    13  
    14  var f = func() int { return 1 }
    15  var _ = f() + g()
    16  var g = func() int { return 2 }
    17  
    18  func main() {}