|
|
@ -68,7 +68,8 @@ func run(cmd *cobra.Command, args []string) { |
|
|
|
go func() { |
|
|
|
go func() { |
|
|
|
if !nomod { |
|
|
|
if !nomod { |
|
|
|
done <- p.New(ctx, wd, repoURL, branch) |
|
|
|
done <- p.New(ctx, wd, repoURL, branch) |
|
|
|
} else { |
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
if _, e := os.Stat(path.Join(wd, "go.mod")); os.IsNotExist(e) { |
|
|
|
if _, e := os.Stat(path.Join(wd, "go.mod")); os.IsNotExist(e) { |
|
|
|
done <- fmt.Errorf("🚫 go.mod don't exists in %s", wd) |
|
|
|
done <- fmt.Errorf("🚫 go.mod don't exists in %s", wd) |
|
|
|
return |
|
|
|
return |
|
|
@ -79,15 +80,14 @@ func run(cmd *cobra.Command, args []string) { |
|
|
|
panic(e) |
|
|
|
panic(e) |
|
|
|
} |
|
|
|
} |
|
|
|
done <- p.Add(ctx, wd, repoURL, branch, mod) |
|
|
|
done <- p.Add(ctx, wd, repoURL, branch, mod) |
|
|
|
} |
|
|
|
|
|
|
|
}() |
|
|
|
}() |
|
|
|
select { |
|
|
|
select { |
|
|
|
case <-ctx.Done(): |
|
|
|
case <-ctx.Done(): |
|
|
|
if errors.Is(ctx.Err(), context.DeadlineExceeded) { |
|
|
|
if errors.Is(ctx.Err(), context.DeadlineExceeded) { |
|
|
|
fmt.Fprint(os.Stderr, "\033[31mERROR: project creation timed out\033[m\n") |
|
|
|
fmt.Fprint(os.Stderr, "\033[31mERROR: project creation timed out\033[m\n") |
|
|
|
} else { |
|
|
|
return |
|
|
|
fmt.Fprintf(os.Stderr, "\033[31mERROR: failed to create project(%s)\033[m\n", ctx.Err().Error()) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
fmt.Fprintf(os.Stderr, "\033[31mERROR: failed to create project(%s)\033[m\n", ctx.Err().Error()) |
|
|
|
case err = <-done: |
|
|
|
case err = <-done: |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
fmt.Fprintf(os.Stderr, "\033[31mERROR: Failed to create project(%s)\033[m\n", err.Error()) |
|
|
|
fmt.Fprintf(os.Stderr, "\033[31mERROR: Failed to create project(%s)\033[m\n", err.Error()) |
|
|
|