liveBook · Manning

Version

As explained in Go in Action, Second Edition

A version number is an identifier representing a particular software release or state, often communicating its compatibility or maturity.

A version identifies a release of a Go module. It gives consumers a specific dependency to select and communicates what kinds of changes they can expect when they upgrade. In a repository with multiple modules, each module has its own version history rather than sharing one release number. section 11.2 section 11.3.5

Go module releases use semantic versions in the form vMAJOR.MINOR.PATCH:

  • Increment MAJOR for an incompatible API change. section 11.2
  • Increment MINOR for backward-compatible functionality. section 11.2
  • Increment PATCH for a backward-compatible bug fix. section 11.2

For a module in a multimodule repository, prefix its Git release tag with the module path: domain/v0.0.1 identifies a release of domain, while storage/v0.0.1 identifies a separate release of storage. A consumer can then select a release in go.mod, such as github.com/YOUR_USERNAME/go-news/domain v0.0.1. section 11.2

cd domain
git add .
git commit -m "Initial domain module with core entities and interfaces"
git tag domain/v0.0.1
git push origin domain/v0.0.1

The commit and tag commands show how a domain module receives and publishes its first module-specific release tag. section 11.2

Release only what changed

An API can move to api/v1.1.0 and a worker to worker/v1.1.0 while domain stays at domain/v0.0.1. If domain later makes a breaking change and moves to v2.0.0, the API and worker must update their go.mod dependencies to adopt it. Version numbers in logs and monitoring also help locate a problematic release and support a rollback. section 11.3.5

How Go in Action, Second Edition covers it

How deep it goes
Defines semantic version increments and demonstrates module-prefixed Git tags and dependency selection, without detailing automated release tooling.
Examples
Uses domain/v0.0.1, storage/v0.0.1, and separately advancing API and worker tags.
What it assumes
Assumes an existing multimodule Go project with modules ready to commit and release.
What you can do after
Operate/configure independent Go module releases with Git tags and go.mod dependency versions.
How it connects
Connects semantic versioning with Go modules, Git tags, go.mod dependencies, and multimodule repositories.

Also explained in

Compare how 5 books explain version →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Go in Action, Second Edition. The section links point to the parts of the book it draws on.