3 回答

TA貢獻(xiàn)1844條經(jīng)驗 獲得超8個贊
protoc(protobuffer 編譯器總是編譯到 Proto3 版本?)
這取決于你的 protobuf 版本和你的 protoc-gen-go 版本。
需要什么額外的支持?
我想你需要安裝protoc-gen-go
我怎樣才能得到一個編譯為 Proto2 的編譯器?
安裝特定版本的 protoc-gen-go
GIT_TAG="v1.2.0" # change as needed
go get -d -u github.com/golang/protobuf/protoc-gen-go
git -C "$(go env GOPATH)"/src/github.com/golang/protobuf checkout $GIT_TAG
go install github.com/golang/protobuf/protoc-gen-go
我注意到在一個系統(tǒng)中 libproto 3.6.1 編譯為 proto2,我不明白這一點(diǎn)。
不確定這個,但如果我沒記錯的話,決定因素是你的 protoc-gen-go 版本。

TA貢獻(xiàn)1712條經(jīng)驗 獲得超3個贊
如果您遇到以下錯誤:
undefined: proto.ProtoPackageIsVersion3
這是因為 protoc-gen-go 的版本不正確。
$ git clone https://github.com/golang/protobuf $ cd ~/protobuf/protoc-gen-go $ git checkout tags/v1.2.0 -b v1.2.0 $ go install
希望它有所幫助!

TA貢獻(xiàn)1909條經(jīng)驗 獲得超7個贊
我跑了這個:
go get github.com/gogo/protobuf
基本上它更新github.com/gogo/protobuf v1.2.1
為github.com/gogo/protobuf v1.3.1
- 3 回答
- 0 關(guān)注
- 237 瀏覽
添加回答
舉報