Skip to content

Commit c4ab8d5

Browse files
authored
disallowed .mod and .sum extension
1 parent 742293a commit c4ab8d5

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Diff for: pkg/plugins/golang/v4/init.go

+10-2
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,16 @@ func checkDir() error {
188188
return nil
189189
}
190190
// Deny files with .go or .yaml extensions
191-
if strings.HasSuffix(info.Name(), ".go") || strings.HasSuffix(info.Name(), ".yaml") {
192-
return fmt.Errorf("target directory contains disallowed file %q", path)
191+
disallowedExtensions := []string{
192+
".go",
193+
".yaml",
194+
".mod",
195+
".sum",
196+
}
197+
for _, ext := range disallowedExtensions {
198+
if strings.HasSuffix(info.Name(), ext) {
199+
return fmt.Errorf("target directory contains disallowed file %q", path)
200+
}
193201
}
194202

195203
return nil

0 commit comments

Comments
 (0)