mirror of
https://github.com/crazybber/awesome-patterns.git
synced 2024-11-22 20:56:02 +03:00
12 lines
376 B
Go
12 lines
376 B
Go
package goroutine
|
|
|
|
import "testing"
|
|
|
|
// A deadlock happens when a group of goroutines are waiting for each other and none of them is able to proceed.
|
|
// The program will get stuck on the channel send operation waiting forever for someone to read the value.
|
|
// Go is able to detect situations like this at runtime.
|
|
func TestDeadlock(t *testing.T) {
|
|
c := make(chan int)
|
|
<-c
|
|
}
|