From 46748fd229e249c0d7a9198a98e6f9450d437478 Mon Sep 17 00:00:00 2001 From: Cosrider Date: Fri, 12 Aug 2022 15:06:34 +0800 Subject: [PATCH] add file descriptor close safely in test Signed-off-by: Cosrider --- collector/os_release_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/collector/os_release_test.go b/collector/os_release_test.go index e37cc34c..46838f15 100644 --- a/collector/os_release_test.go +++ b/collector/os_release_test.go @@ -48,6 +48,8 @@ func TestParseOSRelease(t *testing.T) { if err != nil { t.Fatal(err) } + defer osReleaseFile.Close() + got, err := parseOSRelease(osReleaseFile) if err != nil { t.Fatal(err)