From f7128535bd220b9a72e3ada73cf73b0704f3cc0f Mon Sep 17 00:00:00 2001 From: mattjmcnaughton Date: Wed, 21 Aug 2019 08:59:35 -0400 Subject: [PATCH] Close leaking files in `conformance/walk.go` We want to ensure we close this file handler if it was opened successfully. --- test/conformance/walk.go | 1 + 1 file changed, 1 insertion(+) diff --git a/test/conformance/walk.go b/test/conformance/walk.go index ec60ae87196..db5a9f4e99a 100644 --- a/test/conformance/walk.go +++ b/test/conformance/walk.go @@ -180,6 +180,7 @@ func (v *visitor) comment(x *ast.BasicLit) string { //proximity of the comment and apply it. myf, err := os.Open(v.FileSet.File(x.Pos()).Name()) if err == nil { + defer myf.Close() if _, err := myf.Seek(int64(comm.End()), 0); err == nil { if _, err := myf.Read(b1); err == nil { if strings.Compare(strings.Trim(string(b1), "\t \r\n"), "framework.ConformanceIt(\"") == 0 {