github.com/neilgarb/delve@v1.9.2-nobreaks/_fixtures/testnextprog.go (about) 1 package main 2 3 import ( 4 "fmt" 5 "runtime" 6 "time" 7 ) 8 9 func sleepytime() { 10 time.Sleep(5 * time.Millisecond) 11 } 12 13 func helloworld() { 14 fmt.Println("Hello, World!") 15 } 16 17 func testnext() { 18 var ( 19 j = 1 20 f = 2 21 ) 22 23 for i := 0; i <= 5; i++ { 24 j += j * (j ^ 3) / 100 25 26 if i == f { 27 fmt.Println("foo") 28 break 29 } 30 31 sleepytime() 32 } 33 34 helloworld() 35 } 36 37 func main() { 38 d := make(chan int) 39 testnext() 40 go testgoroutine(9, d) 41 <-d 42 fmt.Println("done") 43 } 44 45 // fix line 46 func testgoroutine(foo int, d chan int) { 47 d <- foo 48 } 49 50 func init() { 51 runtime.LockOSThread() 52 runtime.GOMAXPROCS(4) 53 }