From 6317cf4c6542bf7d560aec4d9741f3f7cd272694 Mon Sep 17 00:00:00 2001 From: HD Stich Date: Tue, 26 Jul 2022 08:33:32 +0200 Subject: [PATCH] Fix constraints check with *-0 PR #176 from upstream --- constraints.go | 2 +- constraints_test.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/constraints.go b/constraints.go index 547613f..9bb0dff 100644 --- a/constraints.go +++ b/constraints.go @@ -233,7 +233,7 @@ func parseConstraint(c string) (*constraint, error) { patchDirty := false dirty := false if isX(m[3]) || m[3] == "" { - ver = "0.0.0" + ver = fmt.Sprintf("0.0.0%s", m[6]) dirty = true } else if isX(strings.TrimPrefix(m[4], ".")) || m[4] == "" { minorDirty = true diff --git a/constraints_test.go b/constraints_test.go index 0504399..ac3e99b 100644 --- a/constraints_test.go +++ b/constraints_test.go @@ -129,6 +129,7 @@ func TestConstraintCheck(t *testing.T) { {"", "1", true}, // An empty string is treated as * or wild card {"", "4.5.6", true}, {"", "1.2.3-alpha.1", false}, + {"*-0", "1.2.3-alpha.1", true}, {"2", "1", false}, {"2", "3.4.5", false}, {"2", "2.1.1", true},