liveBook · Manning

Semantic versioning

As explained in Go in Action, Second Edition

Semantic versioning is a versioning convention in which changes to major, minor, and patch components communicate compatibility and release significance.

A published Go module needs a version so other modules can identify a release and judge whether an update is compatible. Semantic versioning uses the form vMAJOR.MINOR.PATCH: increment MAJOR for incompatible API changes, MINOR for backward-compatible functionality, and PATCH for backward-compatible bug fixes. section 11.2

For an initial domain-module release, commit the entities and interfaces, then tag the commit domain/v0.0.1. In a repository with multiple modules, the domain/ prefix tells Go which module the tag belongs to. A storage module can then depend on that version while implementing the domain.Storage interface. 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

Commands to commit, tag, and push the initial domain-module release. section 11.2

How Go in Action, Second Edition covers it

How deep it goes
Defines major, minor, and patch changes, then shows release tagging; does not elaborate on version-selection rules.
Examples
Uses a domain/v0.0.1 Git tag and a storage module depending on the domain module at v0.0.1.
What it assumes
Assumes a domain module with entities and interfaces; defines the version components before showing how to tag it.
What you can do after
Operate/configure it by tagging a Go module release so another module can depend on its version.
How it connects
Connects semantic versioning to Go modules, Git tags, module dependencies, and API compatibility.

Also explained in

Compare how 8 books explain semantic versioning →

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.