feat(goctl): go work multi-module support (#1800)

* feat(goctl): go work multi-module support

Resolve: #1793

* chore: print log when getting project ctx fails
This commit is contained in:
Fyn
2022-04-18 20:36:41 +08:00
committed by GitHub
parent 92b450eb11
commit e62870e268
5 changed files with 118 additions and 17 deletions

View File

@@ -2,6 +2,7 @@ package ctx
import (
"errors"
"fmt"
"path/filepath"
"github.com/zeromicro/go-zero/tools/goctl/rpc/execx"
@@ -31,6 +32,7 @@ func Prepare(workDir string) (*ProjectContext, error) {
if err == nil {
return ctx, nil
}
fmt.Printf("get project context from workdir[%s] failed: %s\n", workDir, err)
name := filepath.Base(workDir)
_, err = execx.Run("go mod init "+name, workDir)