mirror of
https://github.com/prometheus/prometheus.git
synced 2025-01-13 06:47:28 -08:00
Only close rule file if it could be opened.
This commit is contained in:
parent
5caa2333ab
commit
619aa97025
|
@ -114,9 +114,9 @@ func LoadExprFromString(exprString string) (ast.Node, error) {
|
||||||
|
|
||||||
func LoadExprFromFile(fileName string) (ast.Node, error) {
|
func LoadExprFromFile(fileName string) (ast.Node, error) {
|
||||||
exprReader, err := os.Open(fileName)
|
exprReader, err := os.Open(fileName)
|
||||||
defer exprReader.Close()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
defer exprReader.Close()
|
||||||
return LoadExprFromReader(exprReader)
|
return LoadExprFromReader(exprReader)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue