Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "fmt"
- "time"
- )
- func change(c chan float64) float64 {
- time.Sleep(2 * time.Second)
- return 2.5
- }
- func main() {
- s := 1.1
- c := make(chan float64)
- go change(c)
- s = <-c
- for {
- fmt.Println(s)
- time.Sleep(100 * time.Millisecond)
- }
- }
- fatal error: all goroutines are asleep - deadlock!
- goroutine 1 [chan receive]:
- main.main()
- /home/kramer65/repos/go/src/messing_around/main.go:19 +0x7d
- exit status 2
Add Comment
Please, Sign In to add comment