Nearly all modern software projects rely on third-party dependencies for their work. The vast majority of software projects rely on third-party dependencies for everything, from version control systems to simple string manipulation to complex data storage and manipulation. These packages are often open-source.
Dependencies in Go are called "packages" and "modules". Modules are the modern unit for package distribution, while packages are the smallest unit in grouped Go code. Both packages and modules share a URL naming scheme. This scheme is similar to the Java naming scheme used for Jars, but it is distinct. There are many ways to fetch packages and modules in the modern Go ecosystem and include them into your project. This section will explain what packages and modules are and how to find them. Next, we'll discuss advanced topics such as managing private code, storing dependencies locally (instead of in a hosted environment), and improving build speed and determinism.
Learn how to get started using packages and modules, how to manage both dependency types, how to convert an existing project into modules, and how you can manage your dependencies throughout the duration of your project.
* The Go dependency management system has changed significantly over the course of the history of the language. Modules are however the standard and are part of the official Go CLI tooling. Modules are highly recommended if you're starting a project. If you're currently using another technology to manage dependencies, I recommend looking into whether modules can be used. This section covers both of these scenarios.