mirror of
				https://github.com/ClusterCockpit/cc-metric-collector.git
				synced 2025-11-04 02:35:07 +01:00 
			
		
		
		
	Move defer after checking error
This commit is contained in:
		@@ -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
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user