Skip to content

Commit ada8cd3

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. Expanded the message.
1 parent 26d7b42 commit ada8cd3

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: only go.mod and files with the prefix \".\" can exist before init (found %q)", path)
192191
}
193192
return nil
194193
})

0 commit comments

Comments
 (0)