chapter one

1 Getting started with Go

 

This chapter covers

  • Introducing Go
  • Understanding where Go fits into the language landscape
  • Getting up and running in Go

This chapter the Go language and its features at a high level, providing the foundation for professional developers to use the language to address real world problems encountered on the job. In it, you’ll learn about Go, the toolchain that accompanies it, where it fits into the landscape of languages, and how to install the language and get it running.

1.1 What is Go?

Go, sometimes also referred to as golang, is a statically typed and compiled open source programming language initially developed by Google. In 2007, Robert Griesemer, Rob Pike, and Ken Thompson were attempting to create a language for modern systems programming that solved real-world problems they encountered while building large systems at scale. The language was publicly announced in November 2009.

Instead of attempting to attain theoretical pureness, these designers engineered Go around real-world practical situations. It’s inspired by a number of languages that came before it, including C, Pascal, Java, Python, and many others. The designers tried to take the best aspects of each while reducing perceived complexity. The result is a powerful language that still feels lightweight.

1.2 Noteworthy aspects of Go

1.2.1 Multiple return values

1.2.2 A modern standard library

1.2.3 Concurrency with goroutines and channels

1.2.4 Go the toolchain—more than a language

1.3 Go in the vast language landscape

1.3.1 C and Go

1.3.2 Rust, Zig, Nim, and Go

1.3.3 Java and Go

1.3.4 Python, PHP, and Go

1.3.5 JavaScript, Node.js, and Go

1.4 Getting up and running in Go

1.4.1 Installing Go

1.4.2 Working with Git, Mercurial, and version control

1.4.3 Exploring the workspace

1.4.4 Working with environment variables

1.4.5 Using AI tools with Go

1.5 Hello, Go

1.6 Summary