Sobes.tech
Junior — Senior

Behavior of channels and goroutines in a simple example

livecode

Task condition

Specify what output this program will produce, and provide an explanation of its operation, considering the features of channels and goroutines.

func main() {
    ch := make(chan struct{})

    ch <- struct{}{}

    go func() {
        <-ch
        fmt.Println("good")
    }()
}