From 20499429100480d285a4b16ed6b03947eb22c3b3 Mon Sep 17 00:00:00 2001 From: Egon Elbre Date: Wed, 10 Feb 2021 12:36:27 +0200 Subject: [PATCH] fix file leak --- loc.go | 1 + 1 file changed, 1 insertion(+) diff --git a/loc.go b/loc.go index d7e7634..6e3774b 100644 --- a/loc.go +++ b/loc.go @@ -22,6 +22,7 @@ func CountLines(path string) (*Count, error) { if err != nil { return nil, err } + defer func() { _ = file.Close() }() stat, err := file.Stat() if err != nil {