参考地址:http://golang.org/doc/install.html
一些区别:
-
The most mature implementation. The compiler has an effective optimizer (registerizer) and generates good code (although
gccgo
can do noticeably better sometimes). -
Comparable to the
amd64
port. - Incomplete. It only supports Linux binaries, the optimizer is incomplete, and floating point uses the VFP unit. However, all tests pass. Work on the optimizer is continuing. Tested against a Nexus One.
-
-
-
amd64
(a.k.a.
x86-64
);
6g,6l,6c,6a
386
(a.k.a.
x86
or
x86-32
);
8g,8l,8c,8a
arm
(a.k.a.
ARM
);
5g,5l,5c,5a
安装必要依赖:
$ sudo apt-get install bison gawk gcc libc6-dev make
python-setuptools python-dev build-essential
安装Hg:
$sudo easy_install mercurial
获取go源码:
$ hg clone -u release https://go.googlecode.com/hg/ go
安装:
$ cd go/src
$ ./all.bash
$ ./all.bash
看到如下信息就是安装成功:
--- cd ../test
0 known bugs; 0 unexpected bugs
ALL TESTS PASSED
---
Installed Go for linux/amd64 in /home/zc/opt/go.
Installed commands in /home/zc/opt/go/bin.
The compiler is 6g.
0 known bugs; 0 unexpected bugs
ALL TESTS PASSED
---
Installed Go for linux/amd64 in /home/zc/opt/go.
Installed commands in /home/zc/opt/go/bin.
The compiler is 6g.
验证:
$ cat >hello.go <<EOF
package main
import "fmt"
func main() {
fmt.Printf("hello, world\n")
}
EOF
$ 6g hello.go
$ 6l hello.6
$ ./6.out
hello, world
$
package main
import "fmt"
func main() {
fmt.Printf("hello, world\n")
}
EOF
$ 6g hello.go
$ 6l hello.6
$ ./6.out
hello, world
$
go lang 更新:
$ cd go/src
$ hg pull
$ hg update release
$ ./all.bash
$ hg pull
$ hg update release
$ ./all.bash