Go in 3 Weeks
Published by O'Reilly Media, Inc.
Writing idiomatic and production-grade Go
The Go programming language has been steadily rising in popularity because it’s easy to read and understand, but developers who are making the switch from JavaScript or Python may need a little help up front to become fluent with Go idioms and write production-grade Go code.
Join expert Johnny Boursiquot to level up your Go by reinforcing the basics and honing the advanced techniques with an idiomatic approach to the language. You’ll learn best practices for project layout, testing, reusability, and dependency management, and you’ll understand how to use the Go toolchain, build CLI tools, write robust HTTP servers and clients, handle errors, recognize good package design, and more. You’ll leave ready to apply these techniques to your own projects with confidence.
Week 1: Fundamentals, Building Tools, Testing, and Interfaces
In Week 1, you'll build a strong foundation in Go by reviewing language basics and syntax and exercises. Then you’ll dive into testing with the Go standard library and learn advanced techniques that make testing remote APIs and systems more practical.
Week 2: HTTP Servers and Modules for Dependency Management
This week you’ll dive deep into Go’s out-of-the-box HTTP capabilities, learning how to build resilient servers that can keep themselves safe and build clients that can effectively manage their interactions with remote systems. Rounding out the week, you’ll explore the basics of dependency management using Go modules.
Week 3: Concurrency
In the final week, you’ll ease into multithreaded programming with Go, getting comfortable with its concurrency primitives like goroutines and channels. Then you’ll learn how to structure concurrent code to make it testable, how to properly set up communication between goroutines, and how to leverage common patterns like worker pools and semaphores to ensure concurrency is efficient but safe.
Hands-on learning with interactive sandboxes
All exercises and labs will take place within an O'Reilly interactive sandbox—a complete development environment that's preconfigured with everything you need. There's nothing to install or configure; just click a link and get started!
NOTE: With today’s registration, you’ll be signed up for all three sessions. Although you can attend any of the sessions individually, we recommend participating in all three weeks.
What you’ll learn and how you can apply it
Week 1: Fundamentals, Building Tools, Testing, and Interfaces
- Foundational Go concepts, features, and language syntax
- How to build robust command-line tools
- How to write more testable code with interfaces and advanced testing techniques
- How to use the Go toolchain to build and test your programs
Week 2: HTTP Servers and Modules for Dependency Management
- Must-have foundational knowledge of how HTTP works in the Go standard library
- How to build resilient servers that can withstand flaky clients
- How to write robust clients that can handle throttling and backoff
- Dependency management with Go modules
Week 3: Concurrency
- Go concurrency concepts
- How to use goroutines, channels, and mutexes
- How to handle communication between goroutines
- How to write concurrent code that is testable
- How to leverage patterns that allow you to write efficient and safe concurrent Go
And you’ll be able to:
Week 1: Fundamentals, Building Tools, Testing, and Interfaces
- Use pointers, structs, and methods
- Build a simple command-line tool that performs I/O and pulls in its configuration from the environment
- Test your code by mocking remote services
Week 2: HTTP Servers and Modules for Dependency Management
- Write robust clients that can handle throttling, make use of context propagation, and more
- Write robust servers that can handle intermittent disconnects and long requests effectively
- Create a module and use it in your code
- Upgrade and release your module updates without breaking code that relies on it
Week 3: Concurrency
- Leverage goroutines and channels to synchronize access to a shared resource
- Solve “embarrassingly parallel” problems using Go concurrency techniques
This live event is for you because...
- You’re looking for examples of common Go use cases that you might encounter on the job.
- You’re somewhat new to Go and want to write idiomatic and production-grade code.
- You want to embark on new Go projects or tackle existing ones with confidence.
Prerequisites
- A working knowledge of Go (note that this is not a beginner class)
- Familiarity with working in a terminal
Recommended preparation:
- If you need a refresher or basics, explore A Tour of Go or Go by Example
Recommended follow-up:
- Read Learning Go (book)
Schedule
The time frames are only estimates and may vary according to how the class is progressing.
Week 1: Fundamentals, Building Tools, Testing, and Interfaces
Must-know fundamentals (60 minutes)
- Presentation: Basic types and constructs (how Go supports object-oriented programming, syntax, common uses, and gotchas)
- Hands-on exercise: Use common types and data structures to parse and manipulate strings
- Q&A
- Break
Building tools (60 minutes)
- Presentation: Building command-line tools; more advanced language constructs (pointers, structs, and methods); building and testing programs
- Hands-on exercise: Build a tool that performs I/O and pulls in its configuration from the environment
- Q&A
- Break
Testing and interfaces (60 minutes)
- Presentation: Using the standard library to write tests; techniques (table-driven testing, subtests, benchmarks, and mocks using interfaces); leveraging interfaces to make an application more testable
- Hands-on exercise: Leverage interfaces to make an application more testable
- Q&A
- Break
Week 2: HTTP Servers and Modules for Dependency Management
Building resilient HTTP servers (60 minutes)
- Presentation: Handlers and multiplexers; leveraging the context package for cancellation propagation; testing HTTP-based applications; building resilient servers
- Hands-on exercise: Write robust servers that can handle intermittent disconnects and long requests effectively
- Q&A
- Break
Building robust HTTP clients (60 minutes)
- Presentation: Handling API throttling; backoff strategies; testing; leveraging the context package for cancellation propagation
- Hands-on exercise: Write robust clients that can handle throttling, make use of context propagation, and more
- Q&A
- Break
Modules and managing dependencies (60 minutes)
- Presentation: Wrangling dependencies; common usage patterns; tips for working with the Go toolchain
- Hands-on exercises: Create your own module and use it in your code; upgrade and release your module updates without breaking code that relies on it
- Q&A
Week 3: Concurrency
Concurrency primitives (60 minutes)
- Presentation: Using goroutines, locks, and channels
- Q&A
- Break
Foundational concurrency patterns (60 minutes)
- Presentation: Concurrency patterns in action (WaitGroups, worker pools, and semaphores)
- Hands-on exercise: Leverage goroutines and channels to synchronize access to a shared resource
- Q&A
- Break
Real-world concurrency problem-solving (60 minutes)
- Presentation: Real-world examples of advanced concurrency patterns in action; debugging and troubleshooting thorny concurrency bugs
- Hands-on exercise: Solve an “embarrassingly parallel” problem with Go concurrency techniques
- Q&A
Your Instructor
Johnny Boursiquot
Johnny Boursiquot is a multi-disciplined software engineer with over two decades of experience and a love for teaching and community-building. He stays busy as an educator, speaker, and advocate within the Go programming language community where he also frequently serves as podcast host, user group organizer, and conference program chair. He is currently the Chief Technology Officer at Skilltype.