Publishing Go Modules Tutorial

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.

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.

Read more…

Buy me a coffee
Rating:

comments powered by Disqus