From d46b5b2d27bebbc7e5935d97eee0a01db3721c9c Mon Sep 17 00:00:00 2001 From: Simar Date: Wed, 21 Aug 2024 15:01:59 -0600 Subject: [PATCH] use stat --- pkg/compliance/spec/compliance.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/compliance/spec/compliance.go b/pkg/compliance/spec/compliance.go index 95ed4ea44177..418480129c81 100644 --- a/pkg/compliance/spec/compliance.go +++ b/pkg/compliance/spec/compliance.go @@ -87,7 +87,7 @@ func GetComplianceSpec(specNameOrPath string, c cache.TrivyCache) (ComplianceSpe return ComplianceSpec{}, fmt.Errorf("error retrieving compliance spec from specified path: %w", err) } } else { - _, err := os.ReadFile(filepath.Join(c.GetChecksDir(), "metadata.json")) + _, err := os.Stat(filepath.Join(c.GetChecksDir(), "metadata.json")) if err != nil { // cache corrupt or bundle does not exist, load embedded version b = []byte(sp.NewSpecLoader().GetSpecByName(specNameOrPath)) log.Debug("Compliance spec loaded from embedded library", log.String("spec", specNameOrPath))