From 44e3feb5c6a575a6a6c8d467b39d143e526c728a Mon Sep 17 00:00:00 2001 From: zzjc1234 <2359047351@qq.com> Date: Thu, 17 Oct 2024 18:20:16 +0800 Subject: [PATCH] feat(healthcheck/forbidden): gitignore in subdir --- pkg/healthcheck/forbidden.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/healthcheck/forbidden.go b/pkg/healthcheck/forbidden.go index d533822..f7ce458 100644 --- a/pkg/healthcheck/forbidden.go +++ b/pkg/healthcheck/forbidden.go @@ -16,7 +16,12 @@ func getForbiddens(root string) ([]string, error) { var matches []string // Create a gitignore instance from the .gitignore file - ignore, err := gitignore.NewFromFile(filepath.Join(root, ".gitignore")) + ignore := gitignore.NewRepositoryWithCache(root, ".gitignore", gitignore.NewCache(), func(e gitignore.Error) bool { + return false + }) + + var err error + if err != nil { return nil, err }