Backend development

Stage 1 · Lesson 6 of 10

Goroutines and channels

Your language and how HTTP works

A is a function running at the same time as others, started with go f(). Goroutines are so cheap that you can run tens of thousands at once. The Go runtime spreads them over a few operating system , and puts any goroutine waiting on to one side.

A channel passes values between goroutines and keeps them in step. sync.WaitGroup waits for a group to finish, and sync.Mutex protects shared data. The net/http server already runs each request in its own goroutine, so you rarely start them in handlers.

Common trapa goroutine leak: a goroutine blocked forever on a channel nobody reads or writes. Before you start one, know how it ends and who closes each channel, and run tests with -race.

A question to check yourself, an AI practice session and 2 cheat sheet entries come with the full roadmap. Unlock

Resources for this stage

Start with

  • CourseFree
    A Tour of Go

    The Go Authors · Beginner

    The official interactive tour: basics, methods, interfaces, generics and concurrency

Practise

  • Your language track: small exercises with free mentor feedback on idiomatic code

Keep handy

  • Short runnable examples to look up while you write: errors, JSON, goroutines, testing

  • Read the HTTP overview, methods, headers and status code pages until they feel obvious

Also worth your time

Mark this stage as not done?