Publishing Go Modules Tutorial
How to publish go module?
This post discusses how to write and publish modules so other modules can depend on them.
Please note: this post covers development up to and including v1. A future article will cover developing a module at v2 and beyond, which requires changing the module’s path.
This post is part 1 in a series.
- Part 1 — Using Go Modules
- Part 2 — Migrating To Go Modules
- Part 3 — Publishing Go Modules (this post)
Semantic versions and modules
Every required module in a go.mod has a semantic version, the minimum version of that dependency to use to build the module.
A semantic version has the form vMAJOR.MINOR.PATCH.
- Increment the MAJOR version when you make a backwards incompatible change to the public API of your module. This should only be done when absolutely necessary.
- Increment the MINOR version when you make a backwards compatible change to the API, like changing dependencies or adding a new function, method, struct field, or type.
- Increment the PATCH version after making minor changes that don’t affect your module’s public API or dependencies, like fixing a bug.
Usefull Link
- Part 1 — Using Go Modules
- Part 2 — Migrating To Go Modules