> ~/.bashrcecho "export ..._echo 'export gopath=${home}/go' >> ~/.bashrc $ echo 'expo">
赞
踩
curl -O https://storage.googleapis.com/golang/go1.7.3.linux-amd64.tar.gz
tar -C /usr/local -zxvf go1.7.3.linux-amd64.tar.gz
mkdir -p ~/go/src
echo "export GOPATH=$HOME/go" >> ~/.bashrc
echo "export PATH=$PATH:$GOPATH/bin:/usr/local/go/bin" >> ~/.bashrc
source ~/.bashrc
go version
windows下go的安装:
下golang和liteide
安装好后配置一下环境变量:
GOROOT d:\go
GOPATH d:\gopath
在d:\gopath 下面 创建 src目录
在path系统环境变量添加:
%GOROOT%\bin;%GOPATH%\bin;
打开liteide:
查看-->编辑当前环境
GOROOT=D:\go
运行-->cmd
go version
go env
运行hello world程序:
在src下创建目录hello
新建main.go
package main
import "fmt"
func main(){
fmt.Println("hello world")
}
go build main.go
main
或
go run main.go
有疑问加站长微信联系(非本文作者)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。