4 ms·
Goroutines communicate data via channels, so you can just pass a channel a message (which can be anything). The channel will sit and wait for a message, process
by hellcow 10y ago
Goroutines communicate data via channels, so you can just pass a channel a message (which can be anything). The channel will sit and wait for a message, processing the message when it's received.
That said, for anything like a website or an API you probably won't need to worry much about channels or concurrency at all. The stdlib handles each web request on a different goroutine, so you write synchronous code, yet your server is concurrent.
- SonicSoul 10y agoah yes! This behavior is also supported in Javascript but not as natively as in GO. But there are CSP libraries out there :) http://jlongster.com/Taming-the-Asynchronous-Beast-with-CSP-in-JavaScript http://jlongster.com/Taming-the-Asynchronous-Beast-with-CSP-...