EasyEnv
Engineering/Courses/Catalog/Go/Goroutines and Channels
Go
BeginnerLesson 13 of 2040 min · hands-on

Goroutines and Channels

Part of the Go course

Your program needs to download twenty files. Written the ordinary way, it downloads the first one, waits, downloads the second one, waits, and so on. Almost all of that time is spent doing nothing at all, just waiting for a network that is slower than your processor by a factor of millions. The work would finish twenty times sooner if the waiting overlapped.

Doing several things at once is the oldest hard problem in programming, and most languages make it genuinely difficult. Go was designed around it, and this is the lesson where that shows. You get two ideas. A goroutine is a piece of your program that runs alongside the rest of it. A channel is a pipe for handing values from one goroutine to another, safely, without you having to arrange any locking. ...

Want to learn Go Goroutines and Channels in a real environment?

Click below, get a fresh Linux box with Go ready to go, and work through Goroutines and Channels hands-on with an AI tutor that knows your code.

Start this lessonGoroutines and Channels

What you'll learn

  • The go keyword
  • Goroutine lifetime
  • Unbuffered channels
  • Buffered channels
  • Send and receive
  • Range over channel
  • Close a channel

Read this lesson in your language

All lessons in this course

20 lessons
  1. 1Hello, Go25 min
  2. 2Variables and Types25 min
  3. 3Control Flow: if and for30 min
  4. 4Functions30 min
  5. 5Slices and Maps35 min
  6. 6Structs and Pointers35 min
  7. 7Methods and Interfaces35 min
  8. 8Error Handling35 min
  9. 9Modules and Project Structure35 min
  10. 10Tiny CLI Capstone40 min
  11. 11A Tour of the Standard Library40 min
  12. 12Testing and Benchmarks40 min
  13. 13Goroutines and Channels40 min
  14. 14Concurrency Patterns45 min
  15. 15Generics35 min
  16. 16HTTP Servers45 min
  17. 17Databases with database/sql45 min
  18. 18Performance and Profiling40 min
  19. 19Design Patterns in Go40 min
  20. 20Deployment and Production45 min

Explore other courses

Goroutines and Channels - Go (English) | Engineering Courses