# 环境安装
* * * * *
--: 作者:Mick
时间:2018年8月20日
* * * * *
# :-: Windows安装
### 下载安装包
网址 : https://studygolang.com/dl
![](https://box.kancloud.cn/65c05b5c42da82eefcd549c772cd8840_1165x579.png)
### 激活码
http://idea.lanyus.com/
### 环境变量配置
GOROOT 是go的安装目录
GOBIN 是go的命令执行目录
GPOPATH 是需要你自己创建的开发使用的根目录(类似WWW)
![](https://box.kancloud.cn/143e4a70490d2bc52e23bee974b9a419_587x224.png)
### GOPATH设置
在此目录下创建pkg,bin,src三个文件夹
src 存放源代码(比如:.go .c .h .s等)
pkg 编译后生成的文件(比如:.a)
bin 编译后生成的可执行文件
### Git安装
git直接默认选项安装即可
最后添加环境变量大功告成
![](https://box.kancloud.cn/5c2359eb18e7737c7bd3e85a93580196_386x121.png)
### 测试安装
![](https://box.kancloud.cn/61dcc32902fae1efb40f35c8fa83a022_341x60.png)
### Beego安装
### 获取beego框架
C:\Users\18652>go get github.com/astaxie/beego
查看D:\Gopath\src\github.com\astaxie\beego下面有文件列表
### 获取bee工具
D:\Gopath\src>go get github.com/beego/bee
检测安装进入GOPATH/src
D:\Gopath\src>bee new newproject
# :-: 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编辑器安装
### 直接输入激活码
```
T3ACKYHDVF-eyJsaWNlbnNlSWQiOiJUM0FDS1lIRFZGIiwibGljZW5zZWVOYW1lIjoi5bCP6bifIOeoi+W6j+WRmCIsImFzc2lnbmVlTmFtZSI6IiIsImFzc2lnbmVlRW1haWwiOiIiLCJsaWNlbnNlUmVzdHJpY3Rpb24iOiIiLCJjaGVja0NvbmN1cnJlbnRVc2UiOmZhbHNlLCJwcm9kdWN0cyI6W3siY29kZSI6IklJIiwiZmFsbGJhY2tEYXRlIjoiMjAxOS0wNi0xMyIsInBhaWRVcFRvIjoiMjAyMC0wNi0xMiJ9LHsiY29kZSI6IkFDIiwiZmFsbGJhY2tEYXRlIjoiMjAxOS0wNi0xMyIsInBhaWRVcFRvIjoiMjAyMC0wNi0xMiJ9LHsiY29kZSI6IkRQTiIsImZhbGxiYWNrRGF0ZSI6IjIwMTktMDYtMTMiLCJwYWlkVXBUbyI6IjIwMjAtMDYtMTIifSx7ImNvZGUiOiJQUyIsImZhbGxiYWNrRGF0ZSI6IjIwMTktMDYtMTMiLCJwYWlkVXBUbyI6IjIwMjAtMDYtMTIifSx7ImNvZGUiOiJHTyIsImZhbGxiYWNrRGF0ZSI6IjIwMTktMDYtMTMiLCJwYWlkVXBUbyI6IjIwMjAtMDYtMTIifSx7ImNvZGUiOiJETSIsImZhbGxiYWNrRGF0ZSI6IjIwMTktMDYtMTMiLCJwYWlkVXBUbyI6IjIwMjAtMDYtMTIifSx7ImNvZGUiOiJDTCIsImZhbGxiYWNrRGF0ZSI6IjIwMTktMDYtMTMiLCJwYWlkVXBUb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PBAQDAgWgMA0GCSqGSIb3DQEBCwUAA4ICAQAF8uc+YJOHHwOFcPzmbjcxNDuGoOUIP+2h1R75Lecswb7ru2LWWSUMtXVKQzChLNPn/72W0k+oI056tgiwuG7M49LXp4zQVlQnFmWU1wwGvVhq5R63Rpjx1zjGUhcXgayu7+9zMUW596Lbomsg8qVve6euqsrFicYkIIuUu4zYPndJwfe0YkS5nY72SHnNdbPhEnN8wcB2Kz+OIG0lih3yz5EqFhld03bGp222ZQCIghCTVL6QBNadGsiN/lWLl4JdR3lJkZzlpFdiHijoVRdWeSWqM4y0t23c92HXKrgppoSV18XMxrWVdoSM3nuMHwxGhFyde05OdDtLpCv+jlWf5REAHHA201pAU6bJSZINyHDUTB+Beo28rRXSwSh3OUIvYwKNVeoBY+KwOJ7WnuTCUq1meE6GkKc4D/cXmgpOyW/1SmBz3XjVIi/zprZ0zf3qH5mkphtg6ksjKgKjmx1cXfZAAX6wcDBNaCL+Ortep1Dh8xDUbqbBVNBL4jbiL3i3xsfNiyJgaZ5sX7i8tmStEpLbPwvHcByuf59qJhV/bZOl8KqJBETCDJcY6O2aqhTUy+9x93ThKs1GKrRPePrWPluud7ttlgtRveit/pcBrnQcXOl1rHq7ByB8CFAxNotRUYL9IF5n3wJOgkPojMy6jetQA5Ogc8Sm7RG6vg1yow==
```
### 获取编辑器
https://www.jetbrains.com/go/download/#section=windows
## 1.下载新版破解补丁
点击链接[https://pan.baidu.com/s/16ALpz\_BCXjsRkpS\_PtD23A](https://pan.baidu.com/s/16ALpz_BCXjsRkpS_PtD23A)下载补丁文件`jetbrains-agent.jar`并将它放置到 goland安装目录的\\bin目录下(位置可随意,放这里是怕误操作删除了破解文件)。
![破解补丁](https://img-blog.csdnimg.cn/20190407221444195.jpg?)
## 2.进入项目界面
如果你之前已经使用有效期激活过可跳过此步骤,如果你是刚下载的GoLand,则需要点击激活窗口的“Evaluate for free”免费试用,然后再创建一个空项目,这样就可以进入到GoLand的工作页面
![在这里插入图片描述](https://img-blog.csdnimg.cn/20190410104405340.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9waWc2Ni5ibG9nLmNzZG4ubmV0,size_16,color_FFFFFF,t_70)
![在这里插入图片描述](https://img-blog.csdnimg.cn/20190410104437433.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9waWc2Ni5ibG9nLmNzZG4ubmV0,size_16,color_FFFFFF,t_70)
![在这里插入图片描述](https://img-blog.csdnimg.cn/20190410104534190.jpg?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9waWc2Ni5ibG9nLmNzZG4ubmV0,size_16,color_FFFFFF,t_70)
## 3.修改配置文件
进入到项目界面后,点击GoLand最上面的菜单栏中的 “Help” -> “Edit Custom VM Options …”,如果提示是否要创建文件,请点”Yes”。
![在这里插入图片描述](https://img-blog.csdnimg.cn/20190410104621523.jpg?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9waWc2Ni5ibG9nLmNzZG4ubmV0,size_16,color_FFFFFF,t_70)
在打开的vmoptions编辑窗口末行添加:`-javaagent:你goland的安装目录\jetbrains-agent.jar`
![在这里插入图片描述](https://img-blog.csdnimg.cn/2019041010471042.jpg?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9waWc2Ni5ibG9nLmNzZG4ubmV0,size_16,color_FFFFFF,t_70)
## 4.输入激活码
重启GoLand之后,点击菜单栏中的 “Help” -> “Register …”,这里有两种激活方式:
一、选择最后一种License server激活方式,地址填入:`http://jetbrains-license-server`(应该会自动填上),或者点击按钮:”Discover Server”来自动填充地址,完成激活
![在这里插入图片描述](https://img-blog.csdnimg.cn/20190410104844737.jpg?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9waWc2Ni5ibG9nLmNzZG4ubmV0,size_16,color_FFFFFF,t_70)
参考文章:https://www.cnblogs.com/pig66/p/10420947.html