Almost all modern software projects use third-party dependencies to do their job. From version control systems and simple string manipulation to powerful data storage and manipulation, the vast majority of teams can't get their work done without help from outside packages. Often, these packages come from open source as well.
In Go, dependencies are called "packages" or "modules". Packages are the smallest unit of grouped Go code, and modules are the modern unit of package distribution. Both packages and modules have a URL naming scheme - similar, but distinctly different from the Java naming scheme for Jars. In the modern Go ecosystem, there are several methods by which you can fetch packages and modules and include them in your project. In this section we'll look at what both packages and modules are, how to find them and how to include them in your project, and then move onto advanced topics like managing private code, storing your dependencies onsite (instead of in a public, hosted environment), and improving build determinism and speed.
You'll learn how to get started with packages and modules, several methods to manage either dependency type, convert your existing project to modules, and how to manage your dependencies for the duration of your project, no matter how long.
* The Go dependency management ecosystem has evolved significantly in the history of the language. Modules, however, are the de-facto standard and are built into the official Go CLI tooling. If you're starting a new project, I highly recommend using modules, and if you're using another technology for dependencies, I recommend researching whether you can switch to modules. This section covers both scenarios
Table of contents
- Title: Managing Dependencies in Go
- Release date: May 2020
- Publisher(s): Aaron Schlesinger
- ISBN: None
You might also like
Head First Design Patterns, 2nd Edition
You know you don’t want to reinvent the wheel, so you look to design patterns—the lessons …
Get Programming with Go
Summary Get Programming with Go introduces you to the powerful Go language without confusing jargon or …
Expanded Edition (August 2018) Updated with Design Patterns episodes from the Clean Code series from Clean …
Go in Action
Summary Go in Action introduces the Go language, guiding you from inquisitive developer to Go guru. …