Ubuntu下安装go语言

参考:http://golang.org/doc/install/source

1. 下载go源代码

  1. sudo apt-get install mercurial
  2. hg clone -u release https://code.google.com/p/go

2. 编译安装go

  1. cd ~/go/src
  2. ./all.bash

安装完后会提示如下信息:

  1. ALL TESTS PASSED

  2. ---
  3. Installed Go for linux/amd64 in /home/you/go.
  4. Installed commands in /home/you/go/bin.
  5. *** You need to add /home/you/go/bin to your $PATH. ***


3. 测试go
vi hello.go:

  1. package main

  2. import "fmt"

  3. func main() {
  4. fmt.Printf("hello, world\n")
  5. }

运行:

  1. go run hello.go



更新go

  1. cd ~/go/src
  2. hg pull
  3. hg update release
  4. ./all.bash

 

posted on 2013-09-25 18:37  Stomach_ache  阅读(247)  评论(0编辑  收藏  举报

导航