From 6160c2ac014457affb754f53166be7879d887911 Mon Sep 17 00:00:00 2001 From: comp500 Date: Sat, 19 Nov 2022 20:25:38 +0000 Subject: [PATCH] Use FlexVer to get largest loader version (fixes Forge default version in init) --- core/versionutil.go | 3 +++ go.mod | 3 ++- go.sum | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/core/versionutil.go b/core/versionutil.go index a971227..1a1e888 100644 --- a/core/versionutil.go +++ b/core/versionutil.go @@ -3,6 +3,7 @@ package core import ( "encoding/xml" "errors" + "github.com/unascribed/FlexVer/go/flexver" "strings" ) @@ -93,6 +94,8 @@ func FetchMavenVersionPrefixedList(url string, friendlyName string) func(mcVersi if hasPrefixSplitDash(out.Versioning.Latest, mcVersion) { return allowedVersions, out.Versioning.Latest, nil } + // Sort list to get largest version + flexver.VersionSlice(out.Versioning.Versions.Version).Sort() return allowedVersions, allowedVersions[len(allowedVersions)-1], nil } } diff --git a/go.mod b/go.mod index 921bf2b..bb54d2a 100644 --- a/go.mod +++ b/go.mod @@ -29,6 +29,7 @@ require ( require ( codeberg.org/jmansfield/go-modrinth v0.4.1 github.com/spf13/pflag v1.0.5 + github.com/unascribed/FlexVer/go/flexver v1.0.0 golang.org/x/exp v0.0.0-20220414153411-bcd21879b8fd ) @@ -50,4 +51,4 @@ require ( gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) -go 1.18 +go 1.19 diff --git a/go.sum b/go.sum index eb574b2..0b96896 100644 --- a/go.sum +++ b/go.sum @@ -205,6 +205,8 @@ github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMT github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/unascribed/FlexVer/go/flexver v1.0.0 h1:eaAAWwaT8TiGK75wfEgQRPRVJc1ZIiLTLGUKXxpcs0c= +github.com/unascribed/FlexVer/go/flexver v1.0.0/go.mod h1:OkWZGfmV3DV2ADlgoS7W1+dD1OOci4mEracZCi3ulBk= github.com/vbauerster/mpb/v4 v4.12.2 h1:TsBs1nWRYF0m8cUH13pxNhOUqY6yKcOr2PeSYxp2L3I= github.com/vbauerster/mpb/v4 v4.12.2/go.mod h1:LVRGvMch8T4HQO3eg2pFPsACH9kO/O6fT/7vhGje3QE= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=