honnef.co/go/tools@v0.4.7/staticcheck/testdata/src/example.com/CheckLoopEmptyDefault/CheckLoopEmptyDefault.go.golden (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  			//@ diag(`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  }