mark
mark copied to clipboard
Mark 8.3 misreports version
I just downloaded Mark 8.3 and noticed that mark --version
reports 8.1
.
Looking forward to trying it! Your blog post really sold it to me.
I found the version number hard-coded in main.go here:
https://github.com/kovetskiy/mark/blob/e1d8eccfff67c38ce72c85ce0e11d5b656ea34d1/main.go#L43
I'm no Go expert, and I haven't tried this, but a quick bit of research suggests that a popular way to keep the reported version number in sync is to use -ldflags
with the go build
command to insert dynamic information into the binary at build time, without the need for source code modification.
Digital Ocean published a tutorial on setting version information for Go applications that describes the technique in detail.
Atatus published a blog on using Golang Auto Build Versioning that summarizes the same technique.
According to the goreleaser.yaml workflow, this project uses GoReleaser to publish new versions to GitHub. According to the GoReleaser Quick Start and Builds documentation, the release version is determined by a commit tag. GoReleaser uses either the git describe
command or the GORELEASER_CURRENT_TAG
environment variable to get the tag value.
Putting all this together, it looks like it would be possible to inject the commit tag value into the mark binary at build time.