binenv
binenv copied to clipboard
string -> int type conversion loses `0` prefix in numbers (was: How add app when release with date ?)
Hello! Thanks for binenv. I try add app https://github.com/deref/exo to binenv. But app when release with date
Hey @patsevanton
It should be the same as usual. The culprit here is that version contains a v.
So to handle this, you could use {{ .VersionMajor }}, {{ .VersionMinor }} and {{ .VersionPatch }}.
See bomberman for an example.
Good luck & tell us how it goes.
Thanks. But it another quiestion - https://github.com/deref/exo/releases/download/v2021.07.30/exo-2021.07.30-linux-amd64
Download link have date.
This almost works:
fetch:
url: https://github.com/deref/exo/releases/download/v{{ .VersionMajor }}.{{ .VersionMinor }}.{{ .VersionPatch }}/exo-{{ .VersionMajor }}.{{ .VersionMinor }}.{{ .VersionPatch }}-{{ .OS }}-{{ .Arch }}
However, since there is some type conversion from string to int somewhere, the generated link is
https://github.com/deref/exo/releases/download/v2021.7.30/exo-2021.7.30-linux-amd64
instead of
https://github.com/deref/exo/releases/download/v2021.07.30/exo-2021.07.30-linux-amd64
So I guess we're stuck for now on this one.
Luckily there is a 2021.10.12 version :D
The "issue" comes from the upstream library https://github.com/hashicorp/go-version/blob/master/version.go#L69 See also https://github.com/hashicorp/go-version/issues/86