編譯Thrift支援golang

來源:互聯網
上載者:User
這是一個建立於 的文章,其中的資訊可能已經有所發展或是發生改變。

本文已經是很久以前的文章了,也不知道新版本thrift如何

Thrift是一個跨語言的服務部署架構,Thrift通過一個中繼語言(IDL, 介面定義語言)來定義RPC的介面和資料類型,然後通過一個編譯器產生不同語言的代碼(目前支援C++,Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, Smalltalk和OCaml),並由產生的程式碼負責RPC協議層和傳輸層的實現。

Thrift版本:0.9.2

在編譯支援golang時,依賴gomock,makefile中gomock的包地址是google code(牆外),更改為github即可。

thrift-0.9.2/test/go/Makefile

559         #GOPATH=`pwd` $(GO) get code.google.com/p/gomock/gomock560         GOPATH=`pwd` $(GO) get github.com/rafrombrc/gomock/gomock579         #GOPATH=`pwd` $(GO) install code.google.com/p/gomock/mockgen580         GOPATH=`pwd` $(GO) install github.com/rafrombrc/gomock/mockgen

thrift-0.9.2/test/go/src/common/mock_handler.go

25 import (26         //gomock "code.google.com/p/gomock/gomock"27         gomock "github.com/rafrombrc/gomock/gomock"28         thrifttest "gen/thrifttest"29 )

Thrift一些參考資料:

架構介紹:http://dongxicheng.org/search-engine/thrift-framework-intro/

使用指南:http://dongxicheng.org/search-engine/thrift-guide/

RPC編程:http://dongxicheng.org/search-engine/thrift-rpc/

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.