delve/_fixtures/testnextprog.go
Derek Parker 58db8322ef Improve chan / goroutine coordination
* Properly find next source line for goroutines blocked in chanrecv
* Refactor breakpoint clearing
* Refactor temp breakpoint setting
2015-04-19 17:15:34 -05:00

49 lines
514 B
Go

// fix lines
package main
import (
"fmt"
"time"
)
func sleepytime() {
time.Sleep(5 * time.Millisecond)
}
func helloworld() {
fmt.Println("Hello, World!")
}
func testnext() {
var (
j = 1
f = 2
)
for i := 0; i <= 5; i++ {
j += j * (j ^ 3) / 100
if i == f {
fmt.Println("foo")
break
}
sleepytime()
}
helloworld()
}
func main() {
d := make(chan int)
testnext()
go testgoroutine(9, d)
<-d
fmt.Println("done")
}
// fix line
func testgoroutine(foo int, d chan int) {
d <- foo
}