fix kratos cmd proto generate path

fix kratos cmd proto generate path
pull/1105/head
Ccheers 4 years ago committed by GitHub
parent 9f4c4d9877
commit 95fc17a743
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      cmd/kratos/internal/proto/client/client.go

@ -77,7 +77,6 @@ func walk(dir string, args []string) error {
// generate is used to execute the generate command for the specified proto file
func generate(proto string, args []string) error {
path, name := filepath.Split(proto)
input := []string{
"--proto_path=.",
"--proto_path=" + base.KratosMod(),
@ -93,7 +92,7 @@ func generate(proto string, args []string) error {
input = append(input, "--validate_out=lang=go,paths=source_relative:.")
}
}
input = append(input, name)
input = append(input, proto)
for _, a := range args {
if strings.HasPrefix(a, "-") {
input = append(input, a)
@ -102,7 +101,7 @@ func generate(proto string, args []string) error {
fd := exec.Command("protoc", input...)
fd.Stdout = os.Stdout
fd.Stderr = os.Stderr
fd.Dir = path
fd.Dir = "."
if err := fd.Run(); err != nil {
return err
}

Loading…
Cancel
Save