Ubuntu下安装go语言
参考:http://golang.org/doc/install/source
1. 下载go源代码
- sudo apt-get install mercurial
- hg clone -u release https://code.google.com/p/go
2. 编译安装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
posted on 2013-09-25 18:37 Stomach_ache 阅读(248) 评论(0) 编辑 收藏 举报