Subject: Comparing alpine versions in go

From: Wagde Zabit <[email-masked]>
Date: Sun, 26 Apr 2020 02:21:58 +0300

I am trying to find a go package that compares two alpine packages version.
I tried many packages out there
github.com/mcuadros/go-version
github.com/knqyf263/go-rpm-version
github.com/Masterminds/semver
https://github.com/hashicorp/go-version
But none of them giving the right answer if I try to compare 1.6_rc1-r0 with 1.6-r0, all of them are returing that the rc1 is Greater or some of them can not parse the 1.6_rc1-r0 version
Are you aware of go package that can do the comparison in a proper way?

Thanx
Wagde

---

From: Konstantin Kulikov <[email-masked]>
Date: Sun, 26 Apr 2020 14:47:10 +0300

> Are you aware of go package that can do the comparison in a proper way?

If you have apk installed on target system you can use "apk version -t VER1 VER2".
If not you'll have to port it yourself https://gitlab.alpinelinux.org/alpine/apk-tools/-/blob/master/src/version.c

---

From: Wagde Zabit <[email-masked]>
Date: Sun, 26 Apr 2020 22:53:52 +0300

Thank

It was very helpful

I will implement it in go and go with it :-)

> On 26 Apr 2020, at 14:47, Konstantin Kulikov <[email-masked]> wrote:
>