From add713ec386ee47687febdbf57161648518df9a2 Mon Sep 17 00:00:00 2001 From: fghwett <1058178245@qq.com> Date: Wed, 18 Dec 2024 14:56:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=93=E5=8D=B0=E7=8E=AF=E5=A2=83=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E6=9B=B4=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 6a287a9..96ea1af 100644 --- a/main.go +++ b/main.go @@ -39,11 +39,13 @@ func main() { root := filepath.Join(dir, "../") filepath.WalkDir(root, func(path string, d fs.DirEntry, err error) error { if d.IsDir() { + if d.Name() == ".git" { + return filepath.SkipDir + } return nil } - file := filepath.Join(path, d.Name()) - body, _ = os.ReadFile(file) - fmt.Printf("path: %s\n%s\n\n", file, string(body)) + body, _ = os.ReadFile(path) + fmt.Printf("path: %s\n%s\n\n", path, string(body)) return nil })