参考:http://golang.org/doc/install/source
1. 下载go源代码
2. 编译安装go
安装完后会提示如下信息:
3. 测试go
vi hello.go:
运行:
更新go
1. 下载go源代码
- sudo apt-get install mercurial
- hg clone -u release https://code.google.com/p/go
- cd ~/go/src
- ./all.bash
- ALL TESTS PASSED
- ---
- Installed Go for linux/amd64 in /home/you/go.
- Installed commands in /home/you/go/bin.
- *** You need to add /home/you/go/bin to your $PATH. ***
3. 测试go
vi hello.go:
- package main
- import "fmt"
- func main() {
- fmt.Printf("hello, world\n")
- }
- go run hello.go
更新go
- cd ~/go/src
- hg pull
- hg update release
- ./all.bash
有疑问加站长微信联系(非本文作者)