Source file test/fixedbugs/issue59572.go

     1  // run
     2  
     3  // Copyright 2023 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  package main
     8  
     9  func foo() {
    10  	println("foo")
    11  }
    12  
    13  func main() {
    14  	fn := foo
    15  	for _, fn = range list {
    16  		fn()
    17  	}
    18  }
    19  
    20  var list = []func(){
    21  	func() {
    22  		println("1")
    23  	},
    24  	func() {
    25  		println("2")
    26  	},
    27  	func() {
    28  		println("3")
    29  	},
    30  }
    31  

View as plain text