Chore: Check errors from Close calls (#29562)

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
Arve Knudsen
2020-12-03 10:11:14 +01:00
committed by GitHub
parent 3c9310e93c
commit f2b7fbc32a
14 changed files with 109 additions and 33 deletions

View File

@ -273,7 +273,11 @@ func (pm *PluginManager) scan(pluginDir string, requireSigned bool) error {
if err != nil {
return err
}
defer reader.Close()
defer func() {
if err := reader.Close(); err != nil {
scanner.log.Warn("Failed to close JSON file", "path", jsonFPath, "err", err)
}
}()
jsonParser := json.NewDecoder(reader)
@ -343,7 +347,11 @@ func (s *PluginScanner) loadPlugin(pluginJSONFilePath string) error {
if err != nil {
return err
}
defer reader.Close()
defer func() {
if err := reader.Close(); err != nil {
s.log.Warn("Failed to close JSON file", "path", pluginJSONFilePath, "err", err)
}
}()
jsonParser := json.NewDecoder(reader)
pluginCommon := PluginBase{}