Go modules – the way forward

One limitation of the dep tool is that it does not let us use multiple major versions of a package in our projects, as each path to an imported package must be unique. The following diagram illustrates a simple scenario where packages A and B depend on the same version of package C:

Figure 3: Two packages importing the same version of the C package

Let's say now that we want to test drive v2.0.0, the new major version of the C package. The point here is to gradually update the packages importing C to import the new major version in order to assess that everything works as expected. So we update the Gopkg.toml

Get Hands-On Software Engineering with Golang now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.