update handler generation (#27)

* add execute files

* add protoc-osx

* add rpc generation

* add rpc generation

* add: rpc template generation

* update usage

* fixed env prepare for project in go path

* optimize gomod cache

* add README.md

* format error

* reactor templatex.go

* remove waste code

* update project.go & README.md

* update project.go & README.md
This commit is contained in:
Keson
2020-08-29 00:15:15 +08:00
committed by GitHub
parent f411178a4f
commit 0734bbcab3
15 changed files with 74 additions and 183 deletions

View File

@@ -1,4 +1,4 @@
package gogen
package gen
import (
"errors"
@@ -8,6 +8,7 @@ import (
"strings"
"github.com/dsymonds/gotoc/parser"
"github.com/tal-tech/go-zero/core/lang"
"github.com/tal-tech/go-zero/tools/goctl/rpc/execx"
astParser "github.com/tal-tech/go-zero/tools/goctl/rpc/parser"
@@ -72,8 +73,7 @@ func (g *defaultRpcGenerator) genPb() error {
func (g *defaultRpcGenerator) protocGenGo(target string) error {
src := filepath.Dir(g.Ctx.ProtoFileSrc)
sh := fmt.Sprintf(`export PATH=%s:$PATH
protoc -I=%s --go_out=plugins=grpc:%s %s`, filepath.Join(g.Ctx.GoPath, "bin"), src, target, g.Ctx.ProtoFileSrc)
sh := fmt.Sprintf(`protoc -I=%s --go_out=plugins=grpc:%s %s`, src, target, g.Ctx.ProtoFileSrc)
stdout, err := execx.Run(sh)
if err != nil {
return err