diff --git a/go.mod b/go.mod index cbe4e45..83a361e 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module brunel -go 1.22.5 +go 1.23 require ( github.com/alphadose/haxmap v1.4.0 diff --git a/packages/packages.go b/packages/packages.go index 68e83af..274b745 100644 --- a/packages/packages.go +++ b/packages/packages.go @@ -246,20 +246,21 @@ func processPackageResult(packages *haxmap.Map[string, domain.SourcePackage], re }) return true } + + pk.Version = getHighestVer(pk.Version, newPkg.Version) pkg, ok := pk.Packages.Get(newKey) if !ok { pk.Packages.Set(newKey, newPkg) - return true - } - mVer, _ := version.Parse(pkg.Version) - extVer, _ := version.Parse(strings.Split(newPkg.Version, "+b")[0]) - cmpVal := version.Compare(extVer, mVer) - if cmpVal >= 0 { - pk.Version = getHighestVer(pkg.Version, newPkg.Version) - pk.Packages.Set(newKey, newPkg) - packages.Set(newPkg.Source, pk) - return true + } else { + mVer, _ := version.Parse(pkg.Version) + extVer, _ := version.Parse(strings.Split(newPkg.Version, "+b")[0]) + cmpVal := version.Compare(extVer, mVer) + if cmpVal >= 0 { + pk.Packages.Set(newKey, newPkg) + } } + + packages.Set(newPkg.Source, pk) return true }) } @@ -285,9 +286,9 @@ func ProcessStalePackages(internalPackages *haxmap.Map[string, domain.SourcePack if ver != matchedPackage.Version { matchedPackage.NewVersion = ver matchedPackage.Status = domain.Stale + internalPackages.Set(newPackage, matchedPackage) } - internalPackages.Set(newPackage, matchedPackage) return true }) }