[关闭]
@xxliixin1993 2016-07-19T08:26:24.000000Z 字数 435 阅读 1112

Go环境配置

golang


参考:http://docscn.studygolang.com/doc/install/source

源码编译

  1. # git clone https://go.googlesource.com/go
  2. 或者
  3. # git clone https://github.com/golang/go.git
  4. # cd go
  5. # git checkout master
  6. # cd src
  7. # ./all.bash
  8. 然后将安装好的bin目录加入环境变量中

二进制安装

  1. # tar -C /usr/local/ -xzf go1.6.3.linux-amd64.tar.gz
  2. # export PATH=$PATH:/usr/local/go/bin
  3. 或者添加在/etc/profile

测试是否安装成功

首先创建一个hello.go的文件

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

然后运行测试

  1. # go run hello.go
  2. 输出helloworld为成功
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注