0

When I try to generate a proto file using my Makefile command - protoc --proto_path=proto proto/*.proto --go_out=gen/ , I get this error -

protoc-gen-go: program not found or is not executable
Please specify a program using absolute path or make sure the program is available in your PATH system variable

When I run which go, I have this:

/usr/local/go/bin/go

which protoc returns this -

/usr/local/bin/protoc

Here is how my .zshrc looks like:

export PATH="$PATH:/usr/local/mongodb/bin"
export GOROOT=/usr/local/go

I have also installed the plugins

$ go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.26
$ go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.1

Please else should I add my .zshrc to avoid this error?

shekwo
  • 1,411
  • 1
  • 20
  • 50
  • Does [this answer](https://stackoverflow.com/a/67419012/11810946) help? (i.e. add `export PATH=$PATH:$GOPATH/bin`). – Brits Mar 01 '22 at 20:30

1 Answers1

-1

I suggest you use buf replace protoc, buf is more stable and easy to use without odd issues.

HelloWood
  • 727
  • 4
  • 13
  • Unless I'm mistaken you still need to [install the plug-ins and add them to your path](https://docs.buf.build/tour/generate-go-code#install-plugins). – Brits Mar 02 '22 at 04:44