From dea279267a220bb1b3f4287e649c07dc1af18b99 Mon Sep 17 00:00:00 2001 From: slene Date: Thu, 30 Jun 2016 00:06:18 +0800 Subject: [PATCH] Close file handler in textfile --- collector/textfile.go | 1 + 1 file changed, 1 insertion(+) diff --git a/collector/textfile.go b/collector/textfile.go index b2496054..ab0c3a7d 100644 --- a/collector/textfile.go +++ b/collector/textfile.go @@ -91,6 +91,7 @@ func (c *textFileCollector) parseTextFiles() []*dto.MetricFamily { } var parser expfmt.TextParser parsedFamilies, err := parser.TextToMetricFamilies(file) + file.Close() if err != nil { log.Errorf("Error parsing %s: %v", path, err) error = 1.0