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

     1  package pkg
     2  
     3  func fn() {
     4  	var ch chan int
     5  	select {
     6  	case <-ch:
     7  	default:
     8  	}
     9  
    10  	for {
    11  		select {
    12  		case <-ch:
    13  		default: // MATCH /should not have an empty default case/
    14  		}
    15  	}
    16  
    17  	for {
    18  		select {
    19  		case <-ch:
    20  		default:
    21  			println("foo")
    22  		}
    23  	}
    24  
    25  	for {
    26  		select {
    27  		case <-ch:
    28  		}
    29  	}
    30  }