when I was trying out scenarios on channels in go, I came across a code to reproduce deadlock as below
package main
import (
"fmt"
)
func main() {
c := make(chan bool)
c <- true
}
when I run it using
go run gorouting.go
I am getting the below output
> main.main()
> E:/GO Samples/gorouting.go:13 +0x57
> exit status 2
but when I did run in https://play.golang.org I got more details about the exception, am I missing something in the command or do i need to do any configuration at the machine level?
fatal error: all goroutines are asleep - deadlock!
goroutine 1 [chan send]:
main.main()
/tmp/sandbox592049259/main.go:7 +0x60
I am running with this configuration
go version go1.10.3 windows/amd64
Thanks for the help
When you use go run xxx.go
go only compiles/runs that file within the main package...versus running go install && xxx
where xxx is the name of your executable. go install
builds everything and copies to the bin dir...try that locally.