Protoc-gen-go of go is needed, but because golang is blocked, go get github.com/golang/protobuf/protoc-gen-go always timeout. (But if you persevere and try again and again, you may be able to get it down)
A failed attempt
My last blog wrote about downloading the source code through github first, and then go install. My unsuccessful attempt was exactly this method.
Under $GOPATH/src/golang.org/, git clone https://github.com/golang/protobuf.git can indeed download the source code, but in the subsequent go install you will find that an error is reported that the package cannot be found.
It’s common not to find the package, but you will find that the path it gives is google.golang.org/protobuf/cmd/protoc-gen-go, not only the source code is not in google.golang.org, but also under source/protobuf. There is no cmd.
Successful method
First prepare a correct place for the source code
mkdir -p $GOPATH/src/google.golang.org
cd $GOPATH/src/google.golang.org
Clone the source code
git clone https://e.coding.net/robinqiwei/googleprotobuf.git
You can see that the directory structure of this source code is different from the version of the source code that just failed.
install
go install google.golang.org/protobuf/cmd/protoc-gen-go/
carry out