Skip to content

Commit b71349c

Browse files
committed
Make directory-not-empty error more self-explanatory
When I encountered the error, I had to go to the source to understand the problem. Made the message more user-focused. Also skipped printing the allowlist, both to fit into lint line-length limits and to avoid overwhelming the user.
1 parent 26d7b42 commit b71349c

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

pkg/plugins/golang/v3/init.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ limitations under the License.
1717
package v3
1818

1919
import (
20-
"errors"
2120
"fmt"
2221
"os"
2322
"path/filepath"
@@ -188,7 +187,7 @@ func checkDir() error {
188187
return err
189188
}
190189
if info.Name() != "go.mod" && !strings.HasPrefix(info.Name(), ".") {
191-
return errors.New("only the go.mod and files with the prefix \"(.)\" are allowed before the init")
190+
return fmt.Errorf("target directory is not empty: found existing file %q", path)
192191
}
193192
return nil
194193
})

0 commit comments

Comments
 (0)