github.com/golangci/go-tools@v0.0.0-20190318060251-af6baa5dc196/staticcheck/testdata/src/function-literals/function-literals.go (about)

     1  package pkg
     2  
     3  func fn() int { println(); return 0 }
     4  
     5  var x = func(arg int) { // MATCH "overwritten"
     6  	arg = 1
     7  	println(arg)
     8  }
     9  
    10  var y = func() {
    11  	v := fn() // MATCH "never used"
    12  	v = fn()
    13  	println(v)
    14  }
    15  
    16  var z = func() {
    17  	for {
    18  		if true {
    19  			println()
    20  		}
    21  		break // MATCH "the surrounding loop is unconditionally terminated"
    22  	}
    23  }