Welcome, Go modules - part1
Jul 2018    |    go     golang     modules     1.11    

Go modules: part 1, part 2, part 3

For those strictly interested in what is it and how do I use it? head over to part2.

I’ll skip majority of the historic bits and add a timeline for context. The path towards Go modules…

Makefiles pre-1.0

In the beginning, there were Makefiles such as these, scripts, maybe a ๐Ÿง™ and lots of


An env variable pointing to one or more Go dirs scanned in order, first entry has highest precedence. Usually $HOME/go (default as of 1.8). Click here for more details

go get pulls and stores third party packages ($GOPATH/src). Other commands: go test, go build, etc. use GOPATH to resolve imports.

vendor dir, 1.5 1.6

Introduced as an attempt to achieve reproducibility, availability and play nice with third party tools. Go tools use vendor dir, if present and contains .go files, to resolve imports. The vendor dir will take precedence over GOPATH to resolve imports.

Community-driven dependency managers

There were many over the years, to list a few:
govendor, gb, glide, gom, godep, etc.

dep falls into it's own class. Briefly, it was a petri dish experiment to better understand the problem space of package versioning and dependency management. Some hoped it would become part of the official Go tooling. It did not. No further comment outside a big thank you to all the contributors.


Go modules, 1.11 1.12

Dependency management baked right into Go. Introduces the concept of semantic import versioning and many other goodies for building modular software.

I cannot express how excited I am for go modules! I vividly remember Feb. 20’2018 (which also happens to be my birthday), when Russ released the Go & Versioning series, note the “shorter followup posts” section. I thought to myself, what an awesome present ๐ŸŽ.

If you haven’t been following along, here are a few links to get you up-to-speed.

Key concepts:

semantic import versioning

  1. For brevity, vgo was an experimental (forked) version of Go that brought us an early implementation of Russ's proposal. As I write this, go1.11beta2 is released and has experimental support for Go modules. You should now use go1.11 or higher.