Downloading dependencies with Go modules can be significantly faster than using GOPATH-based dependency management. A fresh dependency download experiment for this post took 9 minutes and 33.845 seconds in GOPATH mode and 10.185 seconds in module mode. This post explains why. The key difference is that modules avoid deep repository clones and can use a module proxy.

For an introduction to Go modules, see https://blog.golang.org/using-go-modules.

GOPATH-based dependency management downloads every dependency into GOPATH/src, doing a deep clone of the version control repository in the process.

So, if you’re in GOPATH mode and your project depends on A, which depends on B, which depends on C, the go command will git clone all three repositories (assuming they're all using git). …

About

Tyler Bui-Palsulich

Engineer at Google, working on Go and Google Cloud Platform

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store