Utwórz kanał

package main
import "fmt"
func main() {

    messages := make(chan string)

    go func() { messages <- "ping" }()

    msg := <-messages
    fmt.Println(msg)
}
//go run main.go
//ping
MrNtlu