@@ -187,21 +187,23 @@ func checkDir() error {
187
187
if isCapitalized && info .Name () != "PROJECT" {
188
188
return nil
189
189
}
190
- // Allow files in the following list
191
- allowedFiles := []string {
192
- "go.mod" , // user might run `go mod init` instead of providing the `--flag` at init
193
- "go.sum" , // auto-generated file related to go.mod
190
+ disallowedExtensions := []string {
191
+ ".go" ,
192
+ ".yaml" ,
193
+ ".mod" ,
194
+ ".sum" ,
194
195
}
195
- for _ , allowedFile := range allowedFiles {
196
- if info .Name () == allowedFile {
196
+ // Deny files with .go or .yaml or .mod or .sum extensions
197
+ for _ , ext := range disallowedExtensions {
198
+ if strings .HasSuffix (info .Name (), ext ) {
197
199
return nil
198
200
}
199
201
}
200
202
// Do not allow any other file
201
203
return fmt .Errorf (
202
- "target directory is not empty (only %s, files and directories with the prefix \" . \" , " +
203
- "files with the suffix \" .md \" or capitalized files name are allowed); " +
204
- "found existing file %q" , strings .Join (allowedFiles , ", " ), path )
204
+ "target directory is not empty and contains a disallowed file %q. " +
205
+ "files with the following extensions [%s] are not allowed to avoid conflicts with the tooling." ,
206
+ path , strings .Join (disallowedExtensions , ", " ))
205
207
})
206
208
if err != nil {
207
209
return err
0 commit comments