Fix issue with getting newest package version + upgrade to go 1.23 RC2

This commit is contained in:
ferreo 2024-08-05 19:42:08 +01:00
parent ee57200fb4
commit b766d5ef80
2 changed files with 13 additions and 12 deletions

2
go.mod
View File

@ -1,6 +1,6 @@
module brunel module brunel
go 1.22.5 go 1.23
require ( require (
github.com/alphadose/haxmap v1.4.0 github.com/alphadose/haxmap v1.4.0

View File

@ -246,20 +246,21 @@ func processPackageResult(packages *haxmap.Map[string, domain.SourcePackage], re
}) })
return true return true
} }
pk.Version = getHighestVer(pk.Version, newPkg.Version)
pkg, ok := pk.Packages.Get(newKey) pkg, ok := pk.Packages.Get(newKey)
if !ok { if !ok {
pk.Packages.Set(newKey, newPkg) pk.Packages.Set(newKey, newPkg)
return true } else {
} mVer, _ := version.Parse(pkg.Version)
mVer, _ := version.Parse(pkg.Version) extVer, _ := version.Parse(strings.Split(newPkg.Version, "+b")[0])
extVer, _ := version.Parse(strings.Split(newPkg.Version, "+b")[0]) cmpVal := version.Compare(extVer, mVer)
cmpVal := version.Compare(extVer, mVer) if cmpVal >= 0 {
if cmpVal >= 0 { pk.Packages.Set(newKey, newPkg)
pk.Version = getHighestVer(pkg.Version, newPkg.Version) }
pk.Packages.Set(newKey, newPkg)
packages.Set(newPkg.Source, pk)
return true
} }
packages.Set(newPkg.Source, pk)
return true return true
}) })
} }
@ -285,9 +286,9 @@ func ProcessStalePackages(internalPackages *haxmap.Map[string, domain.SourcePack
if ver != matchedPackage.Version { if ver != matchedPackage.Version {
matchedPackage.NewVersion = ver matchedPackage.NewVersion = ver
matchedPackage.Status = domain.Stale matchedPackage.Status = domain.Stale
internalPackages.Set(newPackage, matchedPackage)
} }
internalPackages.Set(newPackage, matchedPackage)
return true return true
}) })
} }