Skip to content

Commit

Permalink
Fix generate .pb.go under Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
RPRX authored Oct 19, 2020
1 parent 5bd893b commit 3d378fc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions infra/vprotogen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ func main() {
GOBIN := common.GetGOBIN()
protoc := core.ProtocMap[runtime.GOOS]

EXE := ""
if runtime.GOOS == "windows" {
EXE = ".exe"
}

protoFilesMap := make(map[string][]string)
walkErr := filepath.Walk("./", func(path string, info os.FileInfo, err error) error {
if err != nil {
Expand Down Expand Up @@ -50,9 +55,9 @@ func main() {
for _, relProtoFile := range files {
var args []string
if core.ProtoFilesUsingProtocGenGoFast[relProtoFile] {
args = []string{"--gofast_out", pwd, "--plugin", "protoc-gen-gofast=" + GOBIN + "/protoc-gen-gofast"}
args = []string{"--gofast_out", pwd, "--plugin", "protoc-gen-gofast=" + GOBIN + "/protoc-gen-gofast" + EXE}
} else {
args = []string{"--go_out", pwd, "--go-grpc_out", pwd, "--plugin", "protoc-gen-go=" + GOBIN + "/protoc-gen-go", "--plugin", "protoc-gen-go-grpc=" + GOBIN + "/protoc-gen-go-grpc"}
args = []string{"--go_out", pwd, "--go-grpc_out", pwd, "--plugin", "protoc-gen-go=" + GOBIN + "/protoc-gen-go" + EXE, "--plugin", "protoc-gen-go-grpc=" + GOBIN + "/protoc-gen-go-grpc" + EXE}
}
args = append(args, relProtoFile)
cmd := exec.Command(protoc, args...)
Expand Down

0 comments on commit 3d378fc

Please sign in to comment.