mirror of
https://github.com/project-zot/zot.git
synced 2026-06-18 13:37:57 +08:00
chore: address lint extension review feedback
This commit is contained in:
committed by
GitHub
parent
9cef15aa13
commit
e161f9b28d
@@ -64,18 +64,18 @@ func GetLinter(config *config.Config, log log.Logger) *lint.Linter {
|
||||
}
|
||||
|
||||
func hasLocalTrustStoreMaterial(rootDir string) bool {
|
||||
return hasFile(filepath.Join(rootDir, "_cosign")) ||
|
||||
hasFile(filepath.Join(rootDir, "_notation", "truststore", "x509"))
|
||||
return containsFiles(filepath.Join(rootDir, "_cosign")) ||
|
||||
containsFiles(filepath.Join(rootDir, "_notation", "truststore", "x509"))
|
||||
}
|
||||
|
||||
func hasFile(root string) bool {
|
||||
func containsFiles(root string) bool {
|
||||
stat, err := os.Stat(root)
|
||||
if err != nil || !stat.IsDir() {
|
||||
return false
|
||||
}
|
||||
|
||||
hasMaterial := false
|
||||
_ = filepath.WalkDir(root, func(_ string, d os.DirEntry, err error) error {
|
||||
walkErr := filepath.WalkDir(root, func(_ string, d os.DirEntry, err error) error {
|
||||
if err == nil && !d.IsDir() {
|
||||
hasMaterial = true
|
||||
}
|
||||
@@ -83,5 +83,9 @@ func hasFile(root string) bool {
|
||||
return nil
|
||||
})
|
||||
|
||||
if walkErr != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return hasMaterial
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user