Source file test/closure7.go

     1  // run
     2  
     3  // Copyright 2020 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 g(f func()) {
    10  }
    11  
    12  // Must have exportable name
    13  func F() {
    14  	g(func() {
    15  		ch := make(chan int)
    16  		for {
    17  			select {
    18  			case <-ch:
    19  				return
    20  			default:
    21  			}
    22  		}
    23  	})
    24  }
    25  
    26  func main() {
    27  	F()
    28  }
    29  

View as plain text