1 Getting started

 

This chapter covers

  • Why you should read this book
  • The importance of writing idiomatic and testable code
  • Go’s prominent features

Go is a simple, modern programming language that makes it convenient for individuals and distributed teams to work together to develop efficient, adaptable, maintainable, and scalable software that harnesses the full power of today’s multicore CPU systems. This chapter explores the book’s goals, introduces Go, and showcases Go’s key features without delving fully into its mechanics and idioms. I’ll leave the details to other chapters.

1.1 Why should you read this book?

Getting up to speed with Go is so straightforward that in 2020, I tweeted “Go is easy to learn. Hard to master.” Experienced programmers can learn the basics of Go in a week. Yet using Go to its full potential requires a deep understanding of its idioms and mechanics. So this book has three practical goals:

  • Learning by example
  • Crafting idiomatic, readable code
  • Crafting testable, maintainable code

The following sections dive into these goals.

1.1.1 Learning by example

Rather than presenting boring examples such as foo, bar, baz, Person, and Animal, this book demonstrates how to craft idiomatic, testable Go code from scratch, using practical and realistic examples. This approach will show you why and when to use Go’s features and how to avoid common mistakes, so this book doesn’t provide trivial examples.

1.1.2 Crafting idiomatic code

1.1.3 Crafting testable code

1.2 Why Go?

1.3 Hello, gophers!

1.3.1 Statically and strongly typed language

1.3.2 Compilation and static binary

1.3.3 Go runtime

1.4 Concurrency

1.4.1 Goroutines

1.4.2 Go scheduler

1.4.3 Channels

1.5 Type system