From 19bcaca6e6162ad244e2b0f01fe893038cfd5800 Mon Sep 17 00:00:00 2001 From: decentral1se Date: Mon, 9 Aug 2021 15:05:03 +0200 Subject: [PATCH] fix: catch that suffix comparison bug --- tagcmp.go | 2 +- tagcmp_test.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tagcmp.go b/tagcmp.go index 2e0183d..55d248e 100644 --- a/tagcmp.go +++ b/tagcmp.go @@ -144,7 +144,7 @@ func (t Tag) IsCompatible(tag Tag) bool { return false } - if t.Suffix != "" && tag.Suffix == "" { + if t.Suffix != "" && tag.Suffix == "" || t.Suffix == "" && tag.Suffix != "" { return false } diff --git a/tagcmp_test.go b/tagcmp_test.go index 9fb5fcd..c3af536 100644 --- a/tagcmp_test.go +++ b/tagcmp_test.go @@ -599,6 +599,7 @@ func TestIsCompatible(t *testing.T) { {"1.2.3", "1.2.0", true}, {"5-alpine", "6-alpine", true}, {"5-alpine", "6.5-alpine", false}, + {"5", "5-alpine", false}, } for _, p := range pairs { p1, err := tagcmp.Parse(p.t1)