Skip to content
  • Sign In
  • Try Now
View all events
Go

Go: Beyond the Basics

Published by O'Reilly Media, Inc.

Intermediate content levelIntermediate

Join Brian Ketelsen for a hands-on, practical exploration of advanced topics in Go. Using labs and live coding sessions, Brian takes you beyond the Go you know to the advanced concepts that will help you create faster, more robust, and more maintainable applications.

You’ll learn the right way to manage errors, how to handle communications with unreliable external services, how to benchmark and profile your applications, and how to find and fix hotspots and bottlenecks in your applications, as well as patterns and techniques to make your code easier to test. By the end of the training, your code will look like it belongs in Go’s standard library.

Whether you’re building web applications, network services, or command-line applications, the skills you’ll master in this course will take you—and your Go applications—to the next level.

What you’ll learn and how you can apply it

By the end of this live, hands-on course, you’ll understand:

  • How to write idiomatic Go code that is concise, fast, and easy to test
  • How to use Go’s powerful interfaces to enable code reuse
  • How to use more of Go’s standard library and reduce your dependencies on external code
  • When and how to use Go’s powerful concurrency primitives like mutexes and channels

And you’ll be able to:

  • Gracefully handle errors
  • Build applications that are more resilient, easier to monitor, and easier to maintain

This live event is for you because...

  • You are an experienced Go developer ready to take your applications to the next level of professionalism and reliability
  • You have created some Go applications in your organization, and it’s time to take them into production
  • You have a team of Go developers looking for best practices and advanced techniques to build a sustainable Go ecosystem at your company

Prerequisites

  • Experience building Go applications
  • A basic understanding of Go concepts (e.g., types, functions, and interfaces)
  • Experience using code from Go’s standard library or external Go packages written by other people

Materials or downloads needed in advance:

Recommended Preparation

Learning Path: Go Fundamentals

Schedule

The time frames are only estimates and may vary according to how the class is progressing.

Day One

Writing code like the Go team (30 minutes)

In the first section of the course, you’ll learn to make your code look like it belongs in Go’s standard library—and why that’s important. We’ll cover how to organize your code into packages and what those packages should contain. You’ll discover how to write clearer and more understandable code and learn the unwritten Go patterns and conventions that go beyond “go fmt.”

  • Packages
  • Naming conventions
  • Source code conventions

Effective error management (30 minutes)

You’ll learn how to effectively handle errors in Go by exploring wrong ways to handle errors and better alternatives. You’ll learn when it’s appropriate to handle an error and when it’s appropriate to pass it back up the call stack, and discover some of the ways errors can cause problems for users. You’ll end up with clear guidelines for error handling.

  • Comparing errors with known types
  • Exporting errors
  • Libraries are different
  • Annotating errors
  • Wrapping errors for clarity

Embracing the standard library (30 minutes)

You’ll learn how to get the most out of Go’s amazing standard library. We’ll look at several standard library packages that are highly useful but often ignored, and explore the common interfaces in the standard library. You’ll learn how to write code that is more efficient and with fewer dependencies.

  • Hidden gems in Go’s standard library
  • Common interfaces
  • Using stdlib for maximum effect

Creating useful interfaces (30 minutes)

We’ll look at Go’s interfaces and learn how to employ them for maximum flexibility and code reuse. We’ll single out several interfaces from the standard library and explore what makes them powerful. You’ll learn how to make your abstractions count with concise interfaces.

  • What makes a good interface
  • Standard library interface examples
  • Interface size versus interface utility

Wrangling concurrency (60 minutes)

We’ll explore advanced techniques to enable concurrency in your applications. You’ll learn when and how to use channels and mutexes, as well as the common pitfalls of each, and how to detect and prevent data races and concurrency errors. You’ll also get practical experience using tools like sync.WaitGroup and sync.ErrorGroup to make your applications more reliable.

  • Mutexes
  • Channels
  • sync.WaitGroup
  • sync.ErrorGroup
  • Race detection

Day Two

Profiling and benchmarking(60 minutes)

We’ll begin day two by exploring how you can make your application faster with Go’s tools for profiling, benchmarking, and optimization. Live demonstrations of profiling and optimization workflows and hands-on labs will give you firsthand experience you can use to find performance bottlenecks.

  • GODEBUG
  • pprof and debug/pprof
  • Benchmarks
  • perf
  • Go tool trace

Writing code to be fast the first time (30 minutes)

Building on what we learned from profiling and benchmarking, we’ll explore techniques for creating fast code. You’ll learn how to minimize garbage created in your application, how to build reusable pools of expensive resources, and tricks to make your applications faster.

  • Arrays and slices
  • Make GC faster by creating less garbage
  • Pools
  • Avoiding unnecessary conversions
  • Use the stack

Real-world testing (30 minutes)

We’ll explore real-world code from open-source Go projects to learn how to write testable code. You’ll discover how to create packages, functions, and types that are more testable and how to test hard-to-test corners of your code.

  • Writing testable code
  • Interfaces and mocks
  • Integration tests
  • Testing hard-to-test code

Writing scalable services (30 minutes)

We’ll cover advanced patterns and techniques for building applications that scale beyond your staging environment. You’ll learn how to prevent resource exhaustion by using timeouts and cancellations and how to measure the potential performance of your application to find theoretical maximums your application can handle with a single instance.

  • Timeouts and cancellations using Contexts
  • Measuring throughput
  • Determining your limits
  • Measuring, monitoring, and logging

Q&A (30 minutes)

Your Instructor

  • Brian Ketelsen

    Brian Ketelsen is an experienced leader of technical teams with a strong focus on data warehouses and distributed computing. Writing software for various platforms since 1993, Brian has honed his broad technical skills in a variety of roles ranging from DBA to CIO. A prolific open source enthusiast, he has contributed to some of the largest Go projects, including Docker, Kubernetes, etcd, SkyDNS, Kong, Go-Kit, and Goa. Brian cowrote Go in Action (Manning Press) and spends much of his free time fostering the Go community. He co-organizes GopherCon, the yearly conference for Go programmers held each summer in Denver, and helps organize the Tampa Go Meetup. Brian holds a bachelor’s degree in computer science.

    linkedinXlinksearch