I have been using go modules and an import for a while. The problem I’m describing below has always been there, but was never an issue as the latest version of my dependency worked fine. Until this week.
Did ran hugo mod init … when i started this project
Because a need a specific version (now), i did
$ hugo mod get email@example.com
In my docker build i have:
RUN hugo mod get
It is on this step i get the unwanted behaviour. For some reason it downloads an update:
STEP 18: RUN hugo mod get
hugo: downloading modules …
hugo: collected modules in 3353 ms
go: downloading github.com/hakimel/reveal.js v0.0.0-20210608071857-1be851658f0e
go get: upgraded github.com/hakimel/reveal.js v0.0.0-20201012095104-0582f57517c9 => v0.0.0-20210608071857-1be851658f0e
You updated to the HEAD commit of the git repo, not a tag named “4.1.0”. Could be, there is no tag. Could be that the tags name is v4.1.0. If you want to go 100% sure you create a module of your own, that links the version you want and then tag that module and don’t update it to a higher version. I am pretty sure you can also request a githash as version in hugo mod get and this should stay on that hash then too. But the two lines in your CLI output indicate that you are loading HEAD and not a fixed version.
Edit: even worse. It is NOT a module so there is NO go.mod file and Golang’s module versioning is weird. It assumes it’s either version 1 or 0. Reveal.js is not a hugo module, but you try to load it as module. It has no info so it takes the HEAD. Create your own reveal.js module, then add in it’s configuration the config info from above, then add go.mod and add THAT module to your site and it should have a fixed version.