Starting protobuf in go

28 views
Skip to first unread message

Vijay Viswanath

unread,
Sep 17, 2020, 4:24:27 PM9/17/20
to Protocol Buffers
Hi,

I am new to protobuf and the google environment. Trying to learn about how to use protocol buffers and how its used for communication in google environment.

I wanted to learn protocol buf in golang, since my team uses it and I am new to golang as well. Using a google cloudtop for the exercise.
1. Started from page: go/protobuf and from "Download and install the protocol buffer compiler", I reached https://github.com/protocolbuffers/protobuf-go, but dont know what to do with the source code....
2. So I went to the tutorial page and found another link for compiler installation: https://github.com/protocolbuffers/protobuf/releases/tag/v3.13.0 . The link did not have an explicit zip for go, so I downloaded the "protoc-3.13.0-linux-x86_64.zip" and followed the readme.
3. According to readme, I moved the "/bin/protoc" to my cloudtop's "/usr/bin/protoc". Also copied the contents of "include" folder to "/usr/local/include/".
4. Went to :https://developers.google.com/protocol-buffers/docs/gotutorial for further setup and the page mentions compiler plugin setting up in $GOPATH and $GOBIN and I dont know what paths these two variables must be pointing to. So I setup the $GOPATH to be the  folder from the zip file (which contains bin folder with protoc) and $GOBIN = $GOPATH/bin. Then added "GOPATH/bin" to the PATH variable. 

After this, when I run "go install google.golang.org/protobuf/cmd/protoc-gen-go", I get the error that :
cannot find package "google.golang.org/protobuf/cmd/protoc-gen-go" in $GOROOT and $GOPATH.

When I initially followed it, I could install protoc-gen-go, but then faced issue in importing "google/protobuf/timestamp.proto". So I removed everything (including the protoc in $GOPATH) and tried to install from start.....

Please let me know what to do ?

Thanks,
Vijay


Reply all
Reply to author
Forward
0 new messages