github.com/amarpal/go-tools@v0.0.0-20240422043104-40142f59f616/simple/s1037/testdata/src/example.com/CheckElaborateSleep/LintElaborateSleep.go.golden (about)

     1  package pkg
     2  
     3  import (
     4  	"fmt"
     5  	"time"
     6  )
     7  
     8  func fn() {
     9  	time.Sleep(0)
    10  
    11  	time.Sleep(0)
    12  
    13  	select { //@ diag(`should use time.Sleep`)
    14  	case <-time.After(0):
    15  		fmt.Println("yay")
    16  	}
    17  
    18  	const d = 0
    19  	time.Sleep(d)
    20  
    21  	var ch chan int
    22  	select {
    23  	case <-time.After(0):
    24  	case <-ch:
    25  	}
    26  }