From fb63f8e0cdd6f64e7daa98e499f5e9a5d05dac79 Mon Sep 17 00:00:00 2001 From: Parth Patel <88045217+pxp928@users.noreply.github.com> Date: Fri, 10 Mar 2023 12:57:33 -0500 Subject: [PATCH] fix pkg version check (#563) Signed-off-by: pxp928 --- pkg/assembler/backends/testing/pkg.go | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/pkg/assembler/backends/testing/pkg.go b/pkg/assembler/backends/testing/pkg.go index 2061d7ee3e..1f791627d3 100644 --- a/pkg/assembler/backends/testing/pkg.go +++ b/pkg/assembler/backends/testing/pkg.go @@ -159,19 +159,13 @@ func registerVersion(n *model.PackageName, version, subpath string, qualifiers . } // TODO(mihaimaruseac): This is O(n*m) instead of O(n+m) allFound := true - for i, _ := range v.Qualifiers { - if i%2 != 0 { - continue - } - dbKey := v.Qualifiers[i] - dbValue := v.Qualifiers[i+1] + for _, qualifier := range v.Qualifiers { + dbKey := qualifier.Key + dbValue := qualifier.Value found := false - for j, _ := range inputQualifiers { - if j%2 != 0 { - continue - } - if inputQualifiers[j] == dbKey && - inputQualifiers[j+1] == dbValue { + for _, inputQualifier := range inputQualifiers { + if inputQualifier.Key == dbKey && + inputQualifier.Value == dbValue { found = true break }