Merge pull request #498 from lokichoggio/master

fix: close file
This commit is contained in:
Kubernetes Prow Robot 2022-04-27 07:38:11 -07:00 committed by GitHub
commit 9008b12a01
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -11,10 +11,10 @@ import (
// FromFile loads the configuration from a particular file.
func FromFile(filename string) (*MetricsDiscoveryConfig, error) {
file, err := os.Open(filename)
defer file.Close()
if err != nil {
return nil, fmt.Errorf("unable to load metrics discovery config file: %v", err)
}
defer file.Close()
contents, err := ioutil.ReadAll(file)
if err != nil {
return nil, fmt.Errorf("unable to load metrics discovery config file: %v", err)