Fix unhandled error warnings, error messages (except import.go)

This commit is contained in:
comp500
2019-11-15 22:28:14 +00:00
parent e51537c677
commit a553c3ce08
12 changed files with 113 additions and 44 deletions

View File

@@ -88,10 +88,10 @@ func (m Mod) Write() (string, string, error) {
return "sha256", "", err
}
}
defer f.Close()
h, err := GetHashImpl("sha256")
if err != nil {
_ = f.Close()
return "", "", err
}
w := io.MultiWriter(h, f)
@@ -101,7 +101,11 @@ func (m Mod) Write() (string, string, error) {
enc.Indent = ""
err = enc.Encode(m)
hashString := hex.EncodeToString(h.Sum(nil))
return "sha256", hashString, err
if err != nil {
_ = f.Close()
return "sha256", hashString, err
}
return "sha256", hashString, f.Close()
}
// GetParsedUpdateData can be used to retrieve updater-specific information after parsing a mod file