Skip to content

Instantly share code, notes, and snippets.

@feuyeux
Last active May 23, 2017 03:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save feuyeux/122e0b141415a657f53c698ed42b61a8 to your computer and use it in GitHub Desktop.
Save feuyeux/122e0b141415a657f53c698ed42b61a8 to your computer and use it in GitHub Desktop.

install thrift

brew install thrift

install gvm

zsh < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)

install go

gvm install go1.4
gvm use go1.4
export GOROOT_BOOTSTRAP=$GOROOT
gvm install go1.5
gvm install go1.6
gvm install go1.7
gvm list
export GOPATH=~/go_home

setup thrift-go

go get git.apache.org/thrift.git/lib/go/thrift

learn tutorial

switch the go verion (go1.4 - go1.7) by using gvm use GO_VERSION

first terminal
go_version=go1.7
gvm use $go_version
rm -rf ~/.gvm/pkgsets/$go_version/global
ln -s ~/go_home ~/.gvm/pkgsets/$go_version/global
(only run in first time)
cd $GOPATH/src/git.apache.org/thrift.git/tutorial
thrift -r --gen go tutorial.thrift
mv gen-go/* go/src/
cd $GOPATH/src/git.apache.org/thrift.git/tutorial/go
export GOPATH=$GOPATH:$PWD
go run src/*.go -server=true
second terminal
go_version=go1.7
gvm use $go_version
cd $GOPATH/src/git.apache.org/thrift.git/tutorial/go
export GOPATH=$GOPATH:$PWD
go run src/*.go
clean
$ ll ~/.gvm/pkgsets/go1.4/                          
lrwxr-xr-x  1 erichan  staff   22  8 29 02:53 global -> /Users/erichan/go_home

$ ll ~/.gvm/pkgsets/go1.5        
lrwxr-xr-x  1 erichan  staff   22  8 29 03:12 global -> /Users/erichan/go_home

$ ll ~/.gvm/pkgsets/go1.6        
lrwxr-xr-x  1 erichan  staff   22  8 29 03:13 global -> /Users/erichan/go_home

$ ll ~/.gvm/pkgsets/go1.7        
lrwxr-xr-x  1 erichan  staff   22  8 29 03:14 global -> /Users/erichan/go_home

$ cd /Users/erichan/go_home/src/git.apache.org/thrift.git/tutorial/go/src
$ rm -rf shared tutorial
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment