honnef.co/go/tools@v0.5.0-0.dev.0.20240520180541-dcae280a5e87/simple/s1000/testdata/src/example.com/CheckSingleCaseSelect/single-case-select.go (about)

     1  package pkg
     2  
     3  func fn() {
     4  	var ch chan int
     5  	select { //@ diag(`should use a simple channel send`)
     6  	case <-ch:
     7  	}
     8  outer:
     9  	for { //@ diag(`should use for range`)
    10  		select {
    11  		case <-ch:
    12  			break outer
    13  		}
    14  	}
    15  
    16  	for { //@ diag(`should use for range`)
    17  		select {
    18  		case x := <-ch:
    19  			_ = x
    20  		}
    21  	}
    22  
    23  	for {
    24  		select { //@ diag(`should use a simple channel send`)
    25  		case ch <- 0:
    26  		}
    27  	}
    28  }