From 89f189256ed620a8e004273bdb0985802b7d18e4 Mon Sep 17 00:00:00 2001 From: Falxie_ <94479957+falxie@users.noreply.github.com> Date: Tue, 23 Aug 2022 09:04:09 -0700 Subject: [PATCH] fix: map modinfos by id (#152) * fix: map modinfos by id * chore: undo autoformat * chore: restore formatting --- curseforge/detect.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/curseforge/detect.go b/curseforge/detect.go index f3dc6b5..c067a3c 100644 --- a/curseforge/detect.go +++ b/curseforge/detect.go @@ -90,10 +90,14 @@ var detectCmd = &cobra.Command{ fmt.Printf("Failed to retrieve metadata: %v", err) os.Exit(1) } + modInfosMap := make(map[uint32]modInfo) + for _, v := range modInfos { + modInfosMap[v.ID] = v + } fmt.Println("Creating metadata files...") - for i, v := range res.ExactMatches { - err = createModFile(modInfos[i], v.File, &index, false) + for _, v := range res.ExactMatches { + err = createModFile(modInfosMap[v.ID], v.File, &index, false) if err != nil { fmt.Println(err) os.Exit(1)