Overview

1 Introducing Go

This chapter introduces Go as a pragmatic response to modern software demands: ubiquitous multicore hardware, the need for scalable concurrency, and collaborative development in an open-source world. It frames Go as a language and ecosystem designed to balance development speed with performance, combining a simple, opinionated syntax with robust tooling and a powerful runtime. Aimed at developers with experience in other languages, the chapter sets expectations for a practical journey through Go’s core ideas and the rationale behind its design, to help readers evaluate Go for their stacks.

The text highlights Go’s fast compilation and streamlined dependency management that narrow the productivity gap with dynamic languages, while preserving the safety and performance of a statically typed, compiled language. It emphasizes strong type safety to prevent a class of runtime errors, and presents Go’s integrated concurrency model: lightweight goroutines, channels for safe communication, and a runtime scheduler that makes scalable concurrency approachable—often leveraged transparently through the standard library. Together, these choices let developers write readable, maintainable programs that efficiently utilize modern hardware.

Go’s type system encourages composition over inheritance, enabling simple data-first designs with methods on structs, implicit interfaces for flexible polymorphism, and, more recently, generics for reusable, type-safe algorithms and data structures. The chapter also underscores Go’s low-latency, concurrent garbage collector, tuned for high-throughput services and continuously improving with each release. Finally, it outlines the book’s practical focus—syntax, testing, concurrency primitives, modules, fuzzing, and generics—so readers learn not just how Go works, but why its trade-offs lead to faster, more reliable software.

Working hard? (via XKCD)
compiling
A Common Dynamic Typing Exception
goroutines
Many Goroutines Execute On a Single OS Thread
goroutines
Channels Pass Data Between Goroutines
channels
Inheritance Vs. Composition
inheritance vs. composition

Summary

  • Go is a modern general-purpose language with powerful built-in concurrency features.
  • Go is fast, and compiles quickly, leading to reduced development overhead.
  • Go has a simple, easy-to-use type system with implicit interface implementation and generic programming features.
  • Go is memory-safe and garbage collected, freeing the programmer from both the tedium and the worry of manual memory management.

Hopefully by this point you’re as sold on Go as we were when we released the first edition of Go In Action, hot on the heels of Go Version 1.5. Now here we are nearly 8 years and 14 release cycles later, and there is more to be excited about than ever! Go has grown by leaps and bounds in popularity and features, including Generics, which are the largest addition to the language to date! It’s never been a better time to be a Gopher, and we are happy to welcome you into the fold. Let’s Go!

FAQ

What modern computing challenges does Go aim to solve?Go targets the need for safe, simple concurrency on multi-core hardware, fast build-and-run cycles, and large-scale team development. It pairs built-in concurrency primitives and a capable runtime with strong tooling, opinionated formatting, and an open-source-first ecosystem to streamline collaboration and reuse.
How does Go balance development speed with high performance?Go offers a small, expressive language with fast compilation, static typing, and efficient binaries. You get much of the rapid iteration associated with dynamic languages while retaining the performance of a compiled language and the safety of static types.
Why are Go builds so fast?Go’s compiler analyzes only directly imported packages, uses a simplified dependency model, and leverages modules for reproducible builds. The result is lightning-quick incremental compiles—many programs build in under a second.
What does “type safety” in Go mean, and why does it matter?Every value in Go has a static type known at compile time. Mismatches are caught during compilation, preventing a class of runtime type errors common in dynamically typed code and making programs easier to reason about and test.
What are goroutines, and how do they differ from OS threads?Goroutines are lightweight concurrent functions managed by the Go runtime. Many goroutines multiplex onto a smaller set of OS threads, making them cheaper to create and schedule. This enables programs to run thousands of concurrent tasks efficiently.
What are channels and when should I use buffered vs. unbuffered ones?Channels are typed, synchronized conduits for passing data between goroutines. Unbuffered channels synchronize senders and receivers at the exchange point; buffered channels allow some decoupling by queuing messages. Use unbuffered when you want handoff synchronization; use buffered to smooth bursts or pipeline stages.
How is Go’s type system different from classical OOP?Go favors composition over inheritance. You define behavior with methods on concrete types (often structs), and combine simple types to build richer ones. There are no classes or hierarchies—types remain small, explicit, and easy to reason about.
What role do interfaces play in Go?Interfaces describe behavior via method sets. Any type that implements the required methods satisfies the interface implicitly—no explicit “implements” declaration needed. This enables flexible, decoupled designs and straightforward polymorphism.
What are generics (type parameters) in Go and why use them?Generics let you write functions and data structures that operate over sets of types while preserving type safety and performance. They reduce duplication (for example, numeric algorithms or containers) and complement interfaces where compile-time type relationships matter.
How does Go’s garbage collector impact runtime performance?Go uses a highly optimized, concurrent garbage collector designed for low-latency workloads. It minimizes pauses (often sub-millisecond) and continues to improve each release, letting you write efficient programs without manual memory management.

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


choose your plan

team

monthly
annual
$49.99
$399.99
only $33.33 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Go in Action, Second Edition ebook for free
choose your plan

team

monthly
annual
$49.99
$399.99
only $33.33 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Go in Action, Second Edition ebook for free