closure_names.mx raw

   1  package main
   2  
   3  import "fmt"
   4  
   5  func main() {
   6  	// Termination: a batch program must still be stoppable, so the entry
   7  	// handles the channel the runtime closes on SIGINT/SIGTERM.
   8  	select {
   9  	case <-shutdown:
  10  		return
  11  	default:
  12  	}
  13  
  14  	tag := "outer"
  15  	render := func() (tag string) {
  16  		tag = "closure"
  17  		return tag
  18  	}
  19  	fmt.Println(render(), tag)
  20  }
  21