From 4bdab80ded9ca4a673ae1d1051dc9a6019b4b71b Mon Sep 17 00:00:00 2001 From: guangwu Date: Wed, 22 May 2024 11:29:27 +0800 Subject: [PATCH] fix: close file --- derive/generate.go | 1 + 1 file changed, 1 insertion(+) diff --git a/derive/generate.go b/derive/generate.go index 9396895..17269c0 100644 --- a/derive/generate.go +++ b/derive/generate.go @@ -167,6 +167,7 @@ func newPackage(program *loader.Program, pkgInfo *loader.PackageInfo, plugins [] if err != nil { return nil, fmt.Errorf("opening %s: %v", fileInfo.fullpath, err) } + defer f.Close() if err := format.Node(f, program.Fset, fileInfo.astFile); err != nil { return nil, fmt.Errorf("formatting %s: %v", fileInfo.fullpath, err) }