mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2024-12-25 23:19:06 +01:00
Move defer after checking error
This commit is contained in:
parent
011218ab80
commit
3e329c3324
@ -33,11 +33,11 @@ type CentralConfigFile struct {
|
||||
|
||||
func LoadCentralConfiguration(file string, config *CentralConfigFile) error {
|
||||
configFile, err := os.Open(file)
|
||||
defer configFile.Close()
|
||||
if err != nil {
|
||||
cclog.Error(err.Error())
|
||||
return err
|
||||
}
|
||||
defer configFile.Close()
|
||||
jsonParser := json.NewDecoder(configFile)
|
||||
err = jsonParser.Decode(config)
|
||||
return err
|
||||
|
Loading…
Reference in New Issue
Block a user