GRpc-Go使用筆記

來源:互聯網
上載者:User

標籤:make   linux6   linux   amd   toc   外掛程式   end   .gz   安裝   

 linux下配置GRpc-golang1、git中下載protobuf包2、解壓(/usr/local/protobuf)unzip protobuf-cpp-3.0.0-alpha-3.zip3、進入解壓後的目錄cd protobuf/4、編譯安裝./configuremake && sudo make install5、擷取grpc-golang外掛程式,進入go安裝目錄下的bin目錄,運行以下命令go get -u github.com/golang/protobuf/protoc-gen-go #golang 外掛程式運行後檢查protoc-gen-go可執行檔的位置,bin目錄下6、從grpc包中找出protoc可執行檔,找linux64位的版本,拷貝到/usr/local/bin下7、產生golang的代理類檔案(需要protoc 和 protoc-gen-go 兩個可執行檔),執行以下命令的任意一條:protoc --go_out=gen-go taochees.proto --grpc_out=gen-go --plugin=protoc-gen-grpc=protoc-gen-go或者protoc --go_out=plugins=grpc:./gen-go taochees.proto./gen-go是產生的代理類檔案的儲存路徑taochees.proto 是proto定義檔案8、檔案產生成功後是:taochees.pb.go直接拷貝到go的項目中(或go/src/taochees/taochees.pb.go)即可使用9、C#產生的類庫中repeated和map類型的欄位,產生出來的屬性只有get方法,沒有set方法,因此使用時無法將其他對象賦值給此類屬性,只能通過該屬性的Add或Remove方法新增或移除值  10、go項目編譯中,有可能由於版本不一致導致編譯不過去,根據錯誤資訊更新相應的package即可,此次調試中:需從google上下載最新的golang包(go1.7.3.linux-amd64.tar.gz)( tar -xzvf go1.7.3.linux-amd64.tar.gz),單獨下載最新的net、http2、google.golang.org、golang.org、vendor包下更新golang.org      

GRpc-Go使用筆記

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.