顯示頁面 舊版 反向連結 本頁是唯讀的,您可以看到原始碼,但不能更動它。您如果覺得它不應被鎖上,請詢問管理員。 ====== Cross compile ====== ===== From linux to windows ===== Make sure the toolchain for windows is installed. <code bash> sudo pacman -S mingw-w64-gcc </code> **32bit** <code bash> CGO_ENABLED=1 CC=i686-w64-mingw32-gcc GOOS=windows GOARCH=386 go build -o gorvp.exe main.go </code> **64bit** <code bash> CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc GOOS=windows GOARCH=amd64 go build -o gorvp.exe main.go </code> ====== Install GO on CentOS ====== ===== Binary ===== <code bash> wget https://storage.googleapis.com/golang/go1.7.3.linux-amd64.tar.gz tar -zxf go1.7.3.linux-amd64.tar.gz -C /usr/local/ mkdir /Golang </code> <code bash> vim /etc/profile export GOROOT=/usr/local/go export GOBIN=$GOROOT/bin export GOPKG=$GOROOT/pkg/tool/linux_amd64 export GOARCH=amd64 export GOOS=linux export PATH=$PATH:$GOBIN:$GOPKG vim ~/.bash_profile export GOPATH=/Golang export PATH=$PATH:$GOPATH/bin </code> ==== YUM ==== <code bash> yum install epel -y yum install go -y vim ~/.bash_profile export GOPATH=$HOME/go export PATH=$PATH:$GOPATH/bin </code>