Version fetching refactoring (#373)

* Put modloader version data in struct for legibility

* Create modloader map from list

This is a minor change, but it prevents any errors with the keys not being equal to the modloader's Name field

* Less anonymous functions in modloader version retrieval

With previous code, almost everything was lazy and returned a function. Changed this to only have anonymous function in the modloader definitions, and the rest of the functions all just execute their results immediately instead or returning a function. Makes for a bit more legible code.

* Simplify FetchMavenVersionFiltered

* Rewrite version retrieval

* Use Errorf in versionutil

* Remove httpclient parameter

turned out not to be needed

* Add testing for version retrieval

* Explain fetchMavenWithFilterMap
This commit is contained in:
TheEpicBlock
2026-02-18 23:01:04 +01:00
committed by GitHub
parent 52b123018f
commit 945f852259
12 changed files with 1123 additions and 179 deletions

2
go.sum
View File

@@ -40,6 +40,8 @@ github.com/igorsobreira/titlecase v0.0.0-20140109233139-4156b5b858ac h1:AfRcPFr4
github.com/igorsobreira/titlecase v0.0.0-20140109233139-4156b5b858ac/go.mod h1:KOzUkqpWM2xArNm82cehGc5PBFYV1Qadzzt81aJi7F0=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/jarcoal/httpmock v1.4.1 h1:0Ju+VCFuARfFlhVXFc2HxlcQkfB+Xq12/EotHko+x2A=
github.com/jarcoal/httpmock v1.4.1/go.mod h1:ftW1xULwo+j0R0JJkJIIi7UKigZUXCLLanykgjwBXL0=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=