Concurrency is so central to Go that two of its fundamental tools are just keywords – chan and go. This is a very clever way of hiding the complexity of a well-designed and implemented concurrency model that is easy to use and understand.Â
Concurrency model
Understanding channels and goroutines
Channels are made for communicating, which is why Go's mantra is as follows:
"Do not communicate by sharing memory, share memory by communicating."
A channel is made for sharing data, and it usually connects two or more execution threads in an application, which makes it possible to send and receive data without worrying about data safety. Go has a lightweight implementation of a thread that is managed...