fix: map modinfos by id (#152)

* fix: map modinfos by id

* chore: undo autoformat

* chore: restore formatting
This commit is contained in:
Falxie_ 2022-08-23 09:04:09 -07:00 committed by GitHub
parent f79de590d9
commit 89f189256e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)