add file descriptor close safely in test

Signed-off-by: Cosrider <cosrider7@gmail.com>
This commit is contained in:
Cosrider 2022-08-12 15:06:34 +08:00 committed by Johannes 'fish' Ziemke
parent b43db0de6e
commit 46748fd229

View File

@ -48,6 +48,8 @@ func TestParseOSRelease(t *testing.T) {
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
defer osReleaseFile.Close()
got, err := parseOSRelease(osReleaseFile) got, err := parseOSRelease(osReleaseFile)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)