Practical Go Modules
Published by O'Reilly Media, Inc.
Dependency management is hard, in any programming language. Go 1.11 introduced Go Modules, the standard package manager for Go projects. With Go Modules you can declare and automatically download dependencies on external packages based on semantic versioning leading to a more reliable, reproducible builds of your software.
In this course, we’ll discuss the benefits of using Go Modules and demonstrate how to effectively use the tooling to tackle challenging dependency management problems you might encounter in your own projects. Moreover, you’ll learn about migration strategies if you are planning to transition from another, open source package manager.
What you’ll learn and how you can apply it
By the end of this live, hands-on, online course, you’ll understand:
- The benefits and goals of Go Modules
- How to use the Go Modules tooling to effectively manage dependencies
- Handle real-world dependency management challenges
And you’ll be able to:
- Heavily rely on Go Modules for declaring and consuming dependencies
- Switch to Go Modules from a different, non-standard package manager
This live event is for you because...
- You are a Go developer and want to learn Go Modules from the ground up
- You are a Go developer, used vendoring or other open source package managers and are planning to migrate to Go Modules
Prerequisites
- Basic understanding of Go language
- Exposure to package management concepts, in any language
- Knowledge of other Go package managers is not required
- Installation of Go runtime 13.x or higher
- Installation of an IDE, optimally GoLand (which will be used by the instructor for demonstrating exercise solutions) or VSCode + Go plugin
Recommended preparation:
- Review Head First Go (book) for an introduction to (or refresher on) any basic Go concepts.
Schedule
The time frames are only estimates and may vary according to how the class is progressing.
Why Modules? (35 minutes)
- Discussion: What’s your Main Learning Objective? (5 mins)
- Presentation: Using GOPATH to Resolve Packages (5 mins)
- Presentation: Using Vendoring to Resolve Packages (5 mins)
- Discussion: What Problems Can Arise? (5 mins)
- Presentation: Goals of Modules (5 mins)
- Presentation: Modules Overview, Characteristics and Resolution Workflow (5 mins)
Modules Quickstart (35 minutes)
- Presentation: Initializing Modules for a Project (5 mins)
- Presentation: Recap of Semantic Versioning (5 mins)
- Presentation: Adding a Dependency and Version Selection (5 mins)
- Presentation: Listing Dependency Versions (5 mins)
- Exercise: Initializing and Using Modules for a Project (10 mins)
- Q&A (5 mins)
- Break (5 mins)
Modules Day-To-Day Workflows (40 minutes)
- Presentation: Dealing with Transitive Dependencies (5 mins)
- Exercise: Handling Transitive Dependencies (10 mins)
- Presentation: Verifying Dependencies (5 mins)
- Presentation: Removing Unused Dependencies (5 mins)
- Exercise: Verifying and Tidying Dependencies (10 mins)
- Q&A (5 mins)
Managing Modules Versions (45 minutes)
- Presentation: Module Versioning Rules (10 mins)
- Exercise: Using a Dependency with Multiple Major Versions (10 mins)
- Presentation: Declaring a Dependency by Specific Version, Wildcard or Commit (10 mins)
- Exercise: Executing Module Queries (10 mins)
- Q&A (5 mins)
- Break (5 mins)
Advanced Modules Techniques (65 minutes)
- Presentation: Using Vendoring with Modules (10 mins)
- Exercise: Vendoring Dependencies (10 mins)
- Presentation: Using a Custom Modules Proxy (10 mins)
- Exercise: Using JFrog GoCenter To Proxy Dependencies (10 mins)
- Presentation: Migration Strategies for Adopting Modules (10 mins)
- Exercise: Migrating to Go Modules (10 mins)
Q&A (5 mins)
Summary (5 mins)
Your Instructor
Benjamin Muschko
Benjamin Muschko is a software engineer, consultant, and trainer with more than 20 years of experience in the industry. He specializes in cloud-native application development and transformation, container solutions, DevSecOps, and Continuous Integration/Continuous Delivery implementations. Ben is an author, a frequent speaker at conferences, and an avid open source advocate.