exec: "protoc": executable file not found in %PATH%

I’m trying to generate proto for the very first time. Everything is done under Windows and Go v1.17.

I get stuck on the following error:

go run build.go proto
go get: installing executables with 'go get' in module mode is deprecated.
        To adjust and download dependencies of the current module, use 'go get -d'.
        To install using requirements of the current module, use 'go install'.
        To install ignoring the current module, use 'go install' with a version,
        like 'go install example.com/cmd@latest'.
        For more information, see https://golang.org/doc/go-get-install-deprecation
        or run 'go help get' or 'go help install'.
HEAD is now at b03c65ea skippy peanut butter
Formatting database.proto
cmd\stdiscosrv\database.go:8: running "protoc": exec: "protoc": executable file not found in %PATH%
exit status 1
exit status 1

Obviously, I need to have the protoc (or protoc.exe) binary, but where should I get/compile it from? I’ve only managed to find https://github.com/protocolbuffers/protobuf, but trying to use the precompiled binary from there results only in a mass of errors.

Pre-compiled binary should be fine as long as it’s available on the path, so the errors you are getting is probably the problem you want to fix.

Thank you! The precompiled binary executes correctly, but I didn’t realise that it also required the include folder being present in the same path. In other words, you need to unpack both the binary and the include folder from the archive.

What you ran above installs the correct protoc binary, but you need to have your $GOPATH/bin directory in your $PATH for it to be subsequently found and used.

The folder was in PATH already, yet there were only

protoc-gen-go.exe
protoc-gen-go-grpc.exe
protoc-gen-gogofast.exe

in it, but no protoc.exe for some reason, so I ended up downloading it manually :thinking:.

1 Like

Oh! Right, that one we don’t install automatically, my bad.