gosemantic-versioningglide-golang

How can I set semantic versioning for a Go project and what are commands to set the version?


How can I set semantic versioning for Go project and what are commands to set the version?


Solution

  • The go.dev website has some information about this.

    The "Module version numbering" doc page has information about the versioning standards, and mentions:

    If you’re developing modules for others to use, you apply a version number when you publish the module, tagging the module in its repository. For more, see Publishing a module.

    The "Publishing a module" doc page outlines the steps for publishing your module, including how to set the version number in steps 4 and 5:

    1. Tag the project with a new version number using the git tag command.

    For the version number, use a number that signals to users the nature of changes in this release. For more, see Module version numbering.

    git commit -m "mymodule: changes for v0.1.0"
    git tag v0.1.0
    
    1. Push the new tag to the origin repository.
    git push origin v0.1.0