Fix cue mod init
Signed-off-by: Joel Longtine <joel@dagger.io>
This commit is contained in:
parent
0ddd64f985
commit
072d144e68
11
pkg/pkg.go
11
pkg/pkg.go
@ -169,10 +169,17 @@ func CueModInit(ctx context.Context, parentDir string) error {
|
|||||||
lg := log.Ctx(ctx)
|
lg := log.Ctx(ctx)
|
||||||
|
|
||||||
modDir := path.Join(parentDir, "cue.mod")
|
modDir := path.Join(parentDir, "cue.mod")
|
||||||
|
if err := os.Mkdir(modDir, 0755); err != nil {
|
||||||
|
if !errors.Is(err, os.ErrExist) {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
modFile := path.Join(modDir, "module.cue")
|
modFile := path.Join(modDir, "module.cue")
|
||||||
if _, err := os.Stat(modFile); err != nil {
|
if _, err := os.Stat(modFile); err != nil {
|
||||||
if !errors.Is(err, os.ErrNotExist) {
|
statErr, ok := err.(*os.PathError)
|
||||||
return err
|
if !ok {
|
||||||
|
return statErr
|
||||||
}
|
}
|
||||||
|
|
||||||
lg.Debug().Str("mod", parentDir).Msg("initializing cue.mod")
|
lg.Debug().Str("mod", parentDir).Msg("initializing cue.mod")
|
||||||
|
Reference in New Issue
Block a user