转载:http://www.haiyun.me/archives/1009.html
Centos下使用epel源安装:
1
|
yum
install
golang
|
Centos/Linux下源码安装golang:
1
2
3
4
5
6
7
|
wget https:
//storage
.googleapis.com
/golang/go1
.4.1.linux-amd64.
tar
.gz
tar
-C
/usr/local
-xzf go1.4.1.linux-amd64.
tar
.gz
mkdir
$HOME
/go
echo
'export GOROOT=/usr/local/go'
>> ~/.bashrc
echo
'export GOPATH=$HOME/go'
>> ~/.bashrc
echo
'export PATH=$PATH:$GOROOT/bin:$GOPATH/bin'
>> ~/.bashrc
source
$HOME/.bashrc
|
安装go get工具:
1
|
yum
install
mercurial git bzr subversion
|
Windows下安装:
1
|
https://storage.googleapis.com/golang/go1.4.1.windows-386.zip
|
设置环境变量:
1
2
3
4
5
|
setx GOOS windows
setx GOARCH 386
setx GOROOT
"D:\Program Files\go"
setx GOBIN
"%GOROOT%\bin"
setx
PATH
%PATH%
;D:\Program Files\go\bin"
|