fix: close file in the GrepFile func

This commit is contained in:
guangwu 2024-04-18 15:09:42 +08:00 committed by Ming Deng
parent d703f533d0
commit 5a366cd62b

View File

@ -69,6 +69,7 @@ func GrepFile(patten string, filename string) (lines []string, err error) {
if err != nil {
return
}
defer fd.Close()
lines = make([]string, 0)
reader := bufio.NewReader(fd)
prefix := ""