Log error when failing to close the config file
This commit is contained in:
parent
8c93b3746b
commit
007830ab33
@ -35,7 +35,12 @@ func LoadConfig() Configuration {
|
|||||||
log.Fatal("Unable to open config JSON file: ", err)
|
log.Fatal("Unable to open config JSON file: ", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
defer file.Close()
|
defer func(file *os.File) {
|
||||||
|
err := file.Close()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal("Unable to close config file: ", err)
|
||||||
|
}
|
||||||
|
}(file)
|
||||||
|
|
||||||
// Decode json config file to Configuration struct named config
|
// Decode json config file to Configuration struct named config
|
||||||
decoder := json.NewDecoder(file)
|
decoder := json.NewDecoder(file)
|
||||||
|
Loading…
Reference in New Issue
Block a user