go语言:linux 源码安装

首先下载源码:http://www.golangtc.com/download

解压后,进入src文件夹,执行 ./all.bash

等待安装结束后,把目录复制到/usr/local/里,设置两个环境变量:

export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin

然后就可以测试啦 

Create a file named hello.go and put the following program in it:

package main

import "fmt"

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

Then run it with the go tool:

$ go run hello.go
hello, world

If you see the "hello, world" message then Go is installed correctly.

 

听说最新的GO 1.5 使用go来编译go,看来他们是对自己的东西绝对有信心,没bug啦。

posted on 2015-05-14 23:26  driverdevelop  阅读(592)  评论(0编辑  收藏  举报

导航