作者:Mick
时间:2018年8月20日
Windows安装
- 下载安装包
- 环境变量配置
1.GOROOT 是go的安装目录
2.GOBIN 是go的命令执行目录
3.GOPATH 工作空间是需要你自己创建的开发使用的根目录
GOPATH设置
在此目录下创建pkg,bin,src三个文件夹,描述如下
src 存放源代码(比如:.go .c .h .s等)
pkg 编译后生成的文件(比如:.a)
bin 编译后生成的可执行文件
Git安装
- git直接默认选项安装即可,最后添加环境变量大功告成
-
配置环境变量
-
git运行测试
Beego安装
- 获取beego框架,命令行获取
go get github.com/astaxie/beego
go get github.com/beego/bee - 运行测试(创建项目,进入项目目录,运行项目)
bee new newproject
cd newproject
bee run
浏览器访问 127.0.0.1:8080
Linux或Mac安装
获取go安装包框架(安装包下载网址:https://studygolang.com/dl)
$ wget https://studygolang.com/dl/golang/go1.10.3.linux-amd64.tar.gz
解压移动
$ tar -zxvf go1.10.3.linux-amd64.tar.gz
$ mv go /usr/local/
创建工作空间
$ mkdir -p /usr/local/gopath/{bin,pkg,src}
bin : 目录包含可执行命令
pkg : 目录包含包对象
src : 目录包含go的源文件,它们被组织成包(每个目录都对应一个包)
配置环境变量
$ vim /etc/profile
export GOROOT=/usr/local/go
export GOPATH=/usr/local/gopath
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
$ source /etc/profile
$ go version
Beego安装
-安装git
$ yum -y install git
获取beego框架,获取bee工具
$ yum update nss curl
$ go get -u github.com/astaxie/beego
$ go get -u github.com/beego/bee
测试安装
$ cd $GOPATH/src
$ bee version
| ___
| |/ / ___ ___
| ___ \ / _ \ / _
| |/ /| /| /
_/ _| __| v1.10.0
├── Beego : 1.10.1
├── GoVersion : go1.10.3
├── GOOS : linux
├── GOARCH : amd64
├── NumCPU : 8
├── GOPATH : /usr/local/go/gopath
├── GOROOT : /usr/local/go
├── Compiler : gc
└── Date : Wednesday, 8 Aug 2018
Windows之Golang编辑器安装
- 获取编辑器
https://www.jetbrains.com/go/download/#section=windows
- 直接输入激活码
T3ACKYHDVF-eyJsaWNl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