liveBook · Manning

Goroutine

A goroutine is a lightweight function execution unit managed by the Go runtime that runs concurrently with other program activity.

How 7 Manning books explain it

Go in Practice, Second Edition

A goroutine is a lightweight Go-managed execution context that runs a function concurrently with other program activity.

How it is used
Runs background tasks and independent server or file-processing work without making the initiating function wait.
How deep it goes
Explains launch syntax, lifetime, waiting, panic handling, and shutdown patterns, while leaving detailed concurrency theory and runtime internals aside.
Examples
Uses a timed input echo, parallel Gzip compression, and connection-handling servers to show concurrent work.
What you can do after
Build it from scratch with `go`, `sync.WaitGroup`, and channels to start work, await completion, and arrange safe shutdown.

Read how Go in Practice, Second Edition explains goroutine →

Learn Concurrent Programming with Go

A goroutine is a lightweight Go execution construct that represents a concurrent activity managed by the Go runtime.

How it is used
Models independent concurrent activities so applications can pursue work without waiting at every function call.
How deep it goes
Defines creation and runtime placement, then demonstrates execution order, shared memory, and channel-based result collection without prescribing a required implementation.
Examples
Uses sleeping work calls, a shared countdown, concurrent web-page letter counting, file-search exercises, and parallel factor calculations.
What you can do after
Apply it via Go’s go keyword to run functions concurrently and use channels to collect background results.

Read how Learn Concurrent Programming with Go explains goroutine →

Learn Go with Pocket-Sized Projects

A goroutine is a lightweight independently executing function managed by the Go runtime.

How it is used
Uses goroutines to run independent tasks and explore maze branches concurrently.
How deep it goes
Explains launching, communication, synchronization, lifecycle, and performance tradeoffs while deferring detailed differences from threads.
Examples
Demonstrates message printers, concurrent cache writes, and maze-branch exploration.
What you can do after
Apply goroutines in Go using channels and sync.WaitGroup to communicate and coordinate completion.

Read how Learn Go with Pocket-Sized Projects explains goroutine →

Go in Action, Second Edition

A lightweight Go execution unit that runs a function concurrently with the rest of a program.

How it is used
Uses goroutines to keep network and other independent work progressing without directly managing threads.
How deep it goes
Explains runtime scheduling and relative stack costs, then works through launch, lifetime, synchronization, and fan-out/fan-in.
Examples
Uses concurrent RSS feed fetching and an HTTP handler that aggregates articles and errors.
What you can do after
Apply goroutines with channels and WaitGroup to coordinate concurrent fetches and collect their results.

Read how Go in Action, Second Edition explains goroutine →

100 Go Mistakes and How to Avoid Them

A goroutine is a lightweight independently executing function managed by the Go runtime.

How it is used
Uses goroutines to divide independent work and run background tasks while exposing practical concurrency mistakes.
How deep it goes
Traces workload granularity, shutdown paths, and loop-variable capture through implementations and observed effects.
Examples
Uses parallel merge sort, a configuration watcher, and closures launched from a loop.
What you can do after
Diagnose and debug goroutine leaks, captured loop variables, and parallel work that is too fine-grained.

Read how 100 Go Mistakes and How to Avoid Them explains goroutine →

Build and Orchestrator in Go (From Scratch)

A goroutine is a lightweight concurrent execution unit managed by the Go runtime.

How it is used
Separates background worker operations from API request handling so task processing can continue concurrently.
How deep it goes
Demonstrates `go` calls, continuous loops, and anonymous functions, while deferring goroutine implementation details.
Examples
Uses a queue-polling task loop, concurrent statistics collection and API serving, and a periodic manager-update loop.
What you can do after
Apply it to run worker task processing, statistics collection, and API serving concurrently.

Read how Build and Orchestrator in Go (From Scratch) explains goroutine →

Go by Example

A goroutine is a lightweight Go execution unit that runs a function concurrently with other goroutines.

How it is used
Enables concurrent tasks in crawlers, request dispatchers, distributed programs, and HTTP servers.
How deep it goes
Defines goroutines, demonstrates go calls, and outlines scheduler behavior while deferring full scheduler internals.
Examples
Demonstrates concurrent crawl calls, dispatcher workers and a monitor, and HTTP handlers running per request.
What you can do after
Apply goroutines to launch concurrent work and coordinate completion through channels.

Read how Go by Example explains goroutine →

Also covered in

What to know first

Related concepts

Questions about goroutine

What is goroutine?

A goroutine is a lightweight function execution unit managed by the Go runtime that runs concurrently with other program activity.

Which Manning books explain goroutine?

Go in Practice, Second Edition, Learn Concurrent Programming with Go, Learn Go with Pocket-Sized Projects, Go in Action, Second Edition, 100 Go Mistakes and How to Avoid Them, Build and Orchestrator in Go (From Scratch) and Go by Example.

What should I know before learning goroutine?

Manning books that teach goroutine usually introduce thread, Go, concurrency and shared memory first.

What is the difference between goroutine and thread?

A goroutine is a lightweight function execution unit managed by the Go runtime that runs concurrently with other program activity. A thread is a distinct sequence of execution with its own control flow and state, managed or scheduled by a processor, runtime, or operating system.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.