mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2024-11-10 04:27:25 +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 {
|
func LoadCentralConfiguration(file string, config *CentralConfigFile) error {
|
||||||
configFile, err := os.Open(file)
|
configFile, err := os.Open(file)
|
||||||
defer configFile.Close()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cclog.Error(err.Error())
|
cclog.Error(err.Error())
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
defer configFile.Close()
|
||||||
jsonParser := json.NewDecoder(configFile)
|
jsonParser := json.NewDecoder(configFile)
|
||||||
err = jsonParser.Decode(config)
|
err = jsonParser.Decode(config)
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user