Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

string -> int type conversion loses 0 prefix in numbers (was: How add app when release with date ?) #138

Open
patsevanton opened this issue Aug 3, 2021 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@patsevanton
Copy link
Contributor

Hello! Thanks for binenv.
I try add app https://github.com/deref/exo to binenv.
But app when release with date

@leucos
Copy link
Contributor

leucos commented Aug 3, 2021

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.

@patsevanton
Copy link
Contributor Author

patsevanton commented Aug 3, 2021

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.

@leucos
Copy link
Contributor

leucos commented Aug 3, 2021

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.

@leucos leucos self-assigned this Aug 3, 2021
@leucos leucos added the bug Something isn't working label Aug 3, 2021
@leucos leucos changed the title How add app when release with date ? string -> int type conversion loses 0 prefix in numbers (was: How add app when release with date ?) Aug 3, 2021
@leucos
Copy link
Contributor

leucos commented Oct 16, 2021

Luckily there is a 2021.10.12 version :D

@leucos
Copy link
Contributor

leucos commented Oct 16, 2021

The "issue" comes from the upstream library https://github.com/hashicorp/go-version/blob/master/version.go#L69
See also hashicorp/go-version#86

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants