ubuntu下安装golang

1、安装

sudo apt-get install golang

2、查看go的安装路径

go env

查看 GOROOT="/usr/lib/go-1.6"

3、修改环境变量

export GOROOT=/usr/lib/go-1.6
export PATH=$PATH:$GOROOT/bin

4、测试

$ go

5、创建hello.go

package main
import "fmt"
func main(){
      fmt.Print("hello,world\n")      
}

6、运行

#go run hello.go
hello,world

  

参考:http://www.361way.com/golang-install/4537.html

posted @ 2017-02-04 00:07  fo0ol  阅读(723)  评论(0编辑  收藏  举报