github.com/serversong/goreporter@v0.0.0-20200325104552-3cfaf44fd178/linters/staticcheck/testdata/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  }