liveBook · Manning

What you will learn in Go in Practice, Second Edition

by Nathan Kozyra, Matt Butcher, and Matt Farina

Chapter by chapter

Chapter 1: Getting started with Go

1.1 What is Go? · 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, JavaScript, and Go · 1.4 Getting up and running in Go · 1.4.1 Installing Go · 1.4.2 Working with Git and version control · 1.4.3 Exploring the workspace · 1.4.4 Working with environment variables · 1.4.5 Using artificial intelligence tools with Go · 1.5 Hello, Go · 1.6 Summary

What you learn in chapter 1 →

Chapter 2: A solid foundation: Building a command-line application

2.1 Building CLI applications the Go way · 2.1.1 Command-line flags · 2.1.2 Defining valid values via enums · 2.1.3 Slices, arrays, and maps · 2.1.4 Command-line frameworks · 2.2 Handling configuration · 2.2.1 Using configuration files · 2.2.2 Configuration via environment variables · 2.3 Working with real-world web servers · 2.3.1 Starting up and shutting down a server · 2.3.2 Graceful shutdowns using OS signals · 2.3.3 Routing web requests · 2.4 Summary

What you learn in chapter 2 →

Chapter 3: Structs, interfaces, and generics

3.1 Using structs to represent data · 3.1.1 Creating custom data structures · 3.1.2 Functions inside structs · 3.1.3 Anonymous identifiers · 3.1.4 Tags in structs · 3.1.5 Encoding data in JSON format · 3.2 Contrasts with functional and object-oriented programming · 3.3 Extending functionality with interfaces · 3.4 Simplifying code with generics · 3.4.1 Using functions with generics · 3.4.2 Using constraints and type approximations · 3.5 Summary

What you learn in chapter 3 →

Chapter 4: Handling errors and panics

4.1 Error handling · 4.1.1 Nil best practices · 4.1.2 Custom error types · 4.1.3 Error variables · 4.2 Wrapping errors · 4.3 The panic system · 4.3.1 Differentiating panics from errors · 4.3.2 Working with panics · 4.3.3 Recovering from panics · 4.3.4 Capturing panics with defer · 4.3.5 Handling panics on goroutines · 4.4 Summary

What you learn in chapter 4 →

Chapter 5: Concurrency in Go

5.1 Understanding Go’s concurrency model · 5.2 Working with goroutines · 5.2.1 Waiting for goroutines · 5.2.2 Locking with a mutex · 5.3 Working with channels · 5.3.1 Using channels · 5.3.2 Closing channels · 5.3.3 Locking with buffered channels · 5.4 Summary

What you learn in chapter 5 →

Chapter 6: Formatting, testing, debugging, and benchmarking

6.1 Keeping your code and projects clean · 6.1.1 Keeping code well formatted · 6.1.2 Catching common errors with go vet · 6.1.3 Keeping dependencies updated · 6.2 Logging · 6.2.1 Logging data to different outputs · 6.2.2 Going deeper with structured logging · 6.2.3 Accessing and capturing stack traces · 6.3 Unit testing in Go · 6.3.1 Creating a test suit with table-driven tests · 6.3.2 Fuzzing test input · 6.3.3 Annotating tests with names · 6.3.4 Checking test coverage with go cover · 6.3.5 Wait, where is my debugger? · 6.4 Benchmarking and performance tuning · 6.5 Summary

What you learn in chapter 6 →

Chapter 7: File access and basic networking

7.1 Dealing with files · 7.1.1 Reading files · 7.1.2 Writing to files · 7.2 Basic networking via TCP · 7.2.1 Logging to a network resource · 7.2.2 Handling back pressure in network logging · 7.3 Basic networking with UDP · 7.4 Websockets and server-sent events · 7.4.1 Implementing websockets for real-time chat · 7.4.2 Server-sent events · 7.5 Summary

What you learn in chapter 7 →

Chapter 8: Building an HTTP server

8.1 Routing requests and accepting data · 8.1.1 Routing via HTTP verbs · 8.1.2 More control over our server · 8.2 Routing path values · 8.2.1 Accepting POST data and query parameters · 8.2.2 Processing form data · 8.2.3 Reading and writing cookies and other header data · 8.2.4 Processing JSON Web Tokens · 8.3 Generating errors and basic authentication · 8.4 Summary

What you learn in chapter 8 →

Chapter 9: HTML and email template patterns

9.1 Working with HTML templates · 9.1.1 Standard library HTML package overview · 9.1.2 Adding functionality inside templates · 9.1.3 Limiting template parsing · 9.1.4 When template execution breaks · 9.1.5 Mixing templates · 9.2 Using templates for email · 9.3 Summary

What you learn in chapter 9 →

Chapter 10: Sending and receiving data

10.1 Serving static content · 10.1.1 Serving subdirectories · 10.1.2 Using a file server with custom error pages · 10.1.3 Embedding files in a binary · 10.1.4 Serving from an alternative location · 10.2 Advanced form processing · 10.2.1 Handling form requests · 10.2.2 Accessing multiple values for a form field · 10.2.3 Working with files and multipart submissions · 10.2.4 Uploading multiple files · 10.2.5 Verifying that uploaded file is of an allowed type · 10.2.6 Saving a file incrementally · 10.3 Summary

What you learn in chapter 10 →

Chapter 11: Working with external services

11.1 Consuming REST APIs as a full-featured client · 11.1.1 Using the HTTP client · 11.1.2 When faults happen · 11.2 Passing and handling errors over HTTP · 11.2.1 Generating custom errors · 11.2.2 Reading and using custom errors · 11.3 Parsing and mapping JSON · 11.4 Versioning REST APIs · 11.4.1 API version in the URL · 11.4.2 API version in content type · 11.5 Working with gRPC · 11.6 Summary

What you learn in chapter 11 →

Chapter 12: Cloud-ready applications and communications

12.1 Cloud computing overview · 12.1.1 The types of cloud computing · 12.1.2 Containers and cloud-native applications · 12.2 Microservices and high availability · 12.3 Communicating among services · 12.3.1 Making REST faster · 12.4 Running on cloud servers · 12.4.1 Performing runtime detection · 12.4.2 Building for the cloud · 12.5 Performing runtime monitoring · 12.6 Summary

What you learn in chapter 12 →

Chapter 13: Reflection, code generation, and advanced Go

13.1 Three features of reflection · 13.1.1 Switching based on type and kind · 13.1.2 Discovering whether a value implements an interface · 13.1.3 Accessing fields on a struct · 13.2 Structs, tags, and annotations · 13.2.1 Annotating structs · 13.2.2 Using tag annotations · 13.2.3 Processing tags on a struct · 13.3 Generating Go code with Go code · 13.4 Working with other languages · 13.5 Summary

What you learn in chapter 13 →

Concepts explained in this book

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.