Skip to content

Commit 1001d36

Browse files
authored
Merge pull request #1943 from justinsb/directory_not_empty_message
✨ Make directory-not-empty error more self-explanatory
2 parents f7a5201 + 20df76b commit 1001d36

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pkg/plugins/golang/v3/init.go

+3-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"
@@ -186,7 +185,9 @@ func checkDir() error {
186185
return err
187186
}
188187
if info.Name() != "go.mod" && !strings.HasPrefix(info.Name(), ".") {
189-
return errors.New("only the go.mod and files with the prefix \"(.)\" are allowed before the init")
188+
return fmt.Errorf(
189+
"target directory is not empty (only go.mod and files with the prefix \".\" are allowed); found existing file %q",
190+
path)
190191
}
191192
return nil
192193
})

0 commit comments

Comments
 (0)