Channels
A channel is a typed Go communication mechanism that allows goroutines to send and receive values. Sending and receiving can synchronize goroutines, making channels useful for transferring messages or work between concurrent parts of an application.
Minimal example
messages := make(chan string)
go func() {
messages <- "order accepted"
}()
message := <-messages
fmt.Println(message)Learn this concept
Lesson 5.1 · Channels, select and cleanupUsed in exercises
Exercise 5.3 · Per-user WebSocket hubPrerequisite conceptsGoroutines