Go Language compilation and installation protobuf: protoc-gen-go: program not found or is not executable

 

1.Introduction to protobuf

Google protocol buffer (hereinafter referred to as protocol buffer) is a mixed language data standard in Google company. At present, there are more than 48162 message format definitions and more than 12183. Proto files in use. They are used in RPC systems and continuous data storage systems

Protocol buffers is a portable and efficient structured data storage format, which can be used for the serialization of structured data. It is very suitable for data storage or RPC data exchange format. It is a language independent, platform independent and extensible serialization data format that can be used in communication protocol, data storage and other fields. At present, C + +, Java and python APIs are provided

2. When installing proto Gen go, configure the environment first and then download, otherwise the executable program proto cannot be downloaded; The error is as follows:

protoc-gen-go: program not found or is not executable

1.gedit ~/.bashrc

export PATH = “PATH:$GOPATH/bin”($GOPATH:/opt/gopath)

2.source ~/.bashrc

3.Go get – u GitHub. COM/golang/protobuf/proto
go get – u GitHub. COM/golang/protobuf/proto Gen go

4. Recompile the prototype file to succeed

3.Compile the proto file to generate the pb.go file: proto — go_ Out =. *. Proto (Note: * refers to the target file name)

Similar Posts: