From e57defd8044a34364524cae217159d58c317f6e1 Mon Sep 17 00:00:00 2001 From: Denis Date: Sat, 1 Jan 2022 11:44:54 +0300 Subject: [PATCH] close test descriptor --- analyzer/analyzer_test.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/analyzer/analyzer_test.go b/analyzer/analyzer_test.go index ce3051f1..28896263 100644 --- a/analyzer/analyzer_test.go +++ b/analyzer/analyzer_test.go @@ -14,11 +14,12 @@ import ( "testing" "github.com/google/go-cmp/cmp" + "golang.org/x/tools/go/analysis/analysistest" + "github.com/quasilyte/go-ruleguard/analyzer" "github.com/quasilyte/go-ruleguard/ruleguard/goutil" "github.com/quasilyte/go-ruleguard/ruleguard/irconv" "github.com/quasilyte/go-ruleguard/ruleguard/irprint" - "golang.org/x/tools/go/analysis/analysistest" ) var tests = []struct { @@ -176,7 +177,10 @@ var rulesFile = %s if err != nil { t.Fatal(err) } - defer os.Remove(mainFile.Name()) + defer func() { + mainFile.Close() + os.Remove(mainFile.Name()) + }() _, err = mainFile.WriteString(fmt.Sprintf(analyzerTemplate, irfileBuf.String())) if err != nil { t.Fatal(err)