rpc generation support windows (#28)

* 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

* rpc generation supports windows
This commit is contained in:
Keson
2020-08-29 14:30:17 +08:00
committed by GitHub
parent 0cf4ed46a1
commit 0f97b2019a
5 changed files with 21 additions and 14 deletions

View File

@@ -2,6 +2,7 @@ package gen
import (
"path/filepath"
"runtime"
"strings"
"github.com/tal-tech/go-zero/tools/goctl/util"
@@ -41,5 +42,13 @@ func (g *defaultRpcGenerator) mustGetPackage(dir string) string {
target := g.dirM[dir]
projectPath := g.Ctx.ProjectPath
relativePath := strings.TrimPrefix(target, projectPath)
os := runtime.GOOS
switch os {
case "windows":
relativePath = filepath.ToSlash(relativePath)
case "darwin":
default:
g.Ctx.Fatalln("unexpected os: %s", os)
}
return g.Ctx.Module + relativePath
}