11. Channels
In this chapter, we start exploring concurrency in Go. We begin by discussing the difference between concurrency and parallelism. We cover goroutines—what they are and how they behave. Finally, we discuss channels and how they can be used to communicate between goroutines as well as control them.
Before we get too far into concurrency and channels, there are some quotes about them that may help guide you in their usage:
“I can’t tell you how many times I start with channels, and by the time I’m done, I’ve completely optimized them out.”
— Cory LaNou
“When I first learned about channels, I wanted to use them everywhere. Now, I rarely use them at all.”
— Mat Ryer
The preceding quotes are not intended to steer you away from using channels, ...
Get Go Fundamentals: Gopher Guides now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.