I have a go module release to Github. At the beginning, I tagged it to v1.0.0 it was running perfectly on my main program importing that module directly from Github.
But on the next release, I've tagged it backward to v.0.1.1 because I think my module is not stable yet -> (based on semantic versioning unstable version must begin with 0.x.y).
This makes an issue today because I use golint and this tool, it says go-mod-outdated. Currently, the version is v0.5.x and there is a lot of release before it (before I use lint and some tool for lint)
Any ideas to fix it?
Semver side of things
According to semver, unstable more recent versions can be marked as such with a hyphen, as per spec item 9
So the question here is what have you changed? If you've just added some features, but not introduced any breaking changes to the API, you should tag the unstable release as:
v1.1.0-alpha.1. Fixes to the unstable release can then be tagged asv1.1.0-alpha.2and so on.If you've changed the API of your package in a breaking way, the release should be tagged as
v2.0.0-alpha.1. Fixes to the alpha should be tagged in the same way as before: increasing the last digit after the-alphasuffix.Lastly, if you've not changed the API in any way, nor added any features, then you just tag your version as being
v1.0.1-alpha. Basically, standard semver stuff.Of course, if you're in this particular situation, then the truth is you've prematurely tagged your package as
v1.0.0prematurely, as pushing patches is still causing instability.You can address/retag the existing
v1.0.0version by removing the tag, and tag that version accordingly. This can be easily done using the following commands:OK, the github repository no longer has the
v1.0.0tag. Any clone of the repository might still have the old tag, and if anyone there pushesgit push --tags, that'll restore thev1.0.0tag (hence my comment sayinggit push --tagsis not ideal). If your package is being used in the wild, this requires some communication with all of the users of the package.Lastly, moving forwards, you'd do well reading up on how
go modhandles versions (the gist of it is: follow semver 2.0 and you should be fine). pseudo-releases and pre-releases have a particular format you should useGolang (go mod) specifics
Once a module is tagged and released, it's out there. What you should do is issue a retraction of a broken version using the
retractdirectiveAs @bcmills kindly pointed out in the comments: the
retractdirective only works for later versions. The solution for your particular case (actually being on versionv0.5.x, but wanting to retract releasev1.0.0) can be done by tagging a later version and retracting it:From this point on, the latest version of your package that hasn't been retracted would be
v0.5.x, and you should be all set.To issue the retraction of your optimistically tagged release. If you've re-tagged this release as being, for example,
v0.1.0, then you may be able to use thereplacedirective. I'll be honest, I've never usedreplaceto point one version of my module to another version of the same module, but it's might be worth a shot:I must say: even if this works, it's a hack, and I can't vouch for it playing nice with new versions of your package being released. I'd strongly recommend you to issue a retraction of the
v1.0.0tag, re-tag it (arguablyv0.0.0is the version to use here), and from this point on, follow the semver and golang pre-release/pseudo-release versioning standards.