The page Protocol Buffer Basics: Go says 2 things: 1) Download the package and follow instructions in README 2) Run go install google.golang.org/protobuf/cmd/protoc-gen-go Following the Download Protocol Buffers points to the release page which has tar and zip files for lots of languages (C++, C#, ...) but not Go. The file protobuf-all-3.12.3.tar.gz has many languages, but not Go. The README says for Go, head off to Go support for Protocol Buffers which says that it has been superseded by module google.golang.org/protobuf. There aren't any installation instructions by the time I've got there, just more general stuff pointing to even more pages. So I tried step (2)
go install google.golang.org/protobuf/cmd/protoc-gen-go
and got
can't load package: package google.golang.org/protobuf/cmd/protoc-gen-go: cannot find package "google.golang.org/protobuf/cmd/protoc-gen-go" in any of ...
I have 9 tabs open on my browser pointing to various Golang Protocol Buffer pages, and I still haven't managed to get going. I've downloaded protoc and got it working ok for Java and Python, but installing Go has got me beat so far. Is there a page that tells me what to do, in a simple way? Once upon a time using the Github repository it was easy, but that was long ago... Thanks, Jan
Download protoc-win32. zip from https://developers.google.com/protocol-buffers/docs/downloads. Unzip and add location of the protoc.exe to your PATH environment variable. Run `protoc --version` from command prompt to verify.
This tool generates Go language bindings of service s in protobuf definition files for gRPC. For usage information, please see our quick start guide.
Running
go get -u google.golang.org/protobuf/cmd/protoc-gen-go
first before go install seems to have solved it.
Make sure you have a go.mod
:
go mod init github.com/org/repo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With