diff --git a/cmd/gf/internal/cmd/genpb/genpb.go b/cmd/gf/internal/cmd/genpb/genpb.go index e1c4f8836..023cdb984 100644 --- a/cmd/gf/internal/cmd/genpb/genpb.go +++ b/cmd/gf/internal/cmd/genpb/genpb.go @@ -94,6 +94,9 @@ func (c CGenPb) Pb(ctx context.Context, in CGenPbInput) (out *CGenPbOutput, err mlog.Fatalf(`no proto files found in folder "%s"`, in.Path) } + var originPwd = gfile.Pwd() + defer gfile.Chdir(originPwd) + if err = gfile.Chdir(protoPath); err != nil { mlog.Fatal(err) }