配置本地golang环境
$ wget https://dl.google.com/go/go1.10.2.linux-amd64.tar.gz
$ tar zxvf go1.10.2.linux-amd64.tar.gz
$ sudo mv go /usr/local/
$ echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.profile
$ echo 'export GOROOT=/usr/local/go' >> ~/.profile
$ echo 'export GOPATH=~/go' >> ~/.profile #v2ray的工作目录,down下来的源码和编译生成的文件均在这里
$ source ~/.profile && echo $GOPATH
$ go version
go version go1.10.2 linux/amd64
$ tar zxvf go1.10.2.linux-amd64.tar.gz
$ sudo mv go /usr/local/
$ echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.profile
$ echo 'export GOROOT=/usr/local/go' >> ~/.profile
$ echo 'export GOPATH=~/go' >> ~/.profile #v2ray的工作目录,down下来的源码和编译生成的文件均在这里
$ source ~/.profile && echo $GOPATH
$ go version
go version go1.10.2 linux/amd64
交叉编译golang程序
$ go get -u v2ray.com/core/...
$ go get -u v2ray.com/ext/...
$ go install v2ray.com/ext/tools/build/vbuild
$ $GOPATH/bin/vbuild -os=linux -arch=arm
$ go get -u v2ray.com/ext/...
$ go install v2ray.com/ext/tools/build/vbuild
$ $GOPATH/bin/vbuild -os=linux -arch=arm
编译完成的程序位于$GOPATH目录下.