环境安装


作者:Mick
时间:2018年8月20日


// https://www.cnblogs.com/zhangguosheng1121/p/11448194.html

Windows安装

  • 下载安装包

    网址 : https://studygolang.com/dl

环境安装_第1张图片
微信截图_20180823090913.png
  • 环境变量配置

1.GOROOT 是go的安装目录
2.GOBIN 是go的命令执行目录
3.GOPATH 工作空间是需要你自己创建的开发使用的根目录

环境安装_第2张图片
9936960a5aa40970046c38f7cc2a245.png

GOPATH设置

在此目录下创建pkg,bin,src三个文件夹,描述如下
src 存放源代码(比如:.go .c .h .s等)
pkg 编译后生成的文件(比如:.a)
bin 编译后生成的可执行文件

Git安装

  • git直接默认选项安装即可,最后添加环境变量大功告成
  • 配置环境变量


    环境安装_第3张图片
    图片3.png
  • git运行测试


    图片4.png

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-eyJsaWNlbnNlSWQiOiJUM0FDS1lIRFZGIiwibGljZW5zZWVOYW1lIjoi5bCP6bifIOeoi+W6j+WRmCIsImFzc2lnbmVlTmFtZSI6IiIsImFzc2lnbmVlRW1haWwiOiIiLCJsaWNlbnNlUmVzdHJpY3Rpb24iOiIiLCJjaGVja0NvbmN1cnJlbnRVc2UiOmZhbHNlLCJwcm9kdWN0cyI6W3siY29kZSI6IklJIiwiZmFsbGJhY2tEYXRlIjoiMjAxOS0wNi0xMyIsInBhaWRVcFRvIjoiMjAyMC0wNi0xMiJ9LHsiY29kZSI6IkFDIiwiZmFsbGJhY2tEYXRlIjoiMjAxOS0wNi0xMyIsInBhaWRVcFRvIjoiMjAyMC0wNi0xMiJ9LHsiY29kZSI6IkRQTiIsImZhbGxiYWNrRGF0ZSI6IjIwMTktMDYtMTMiLCJwYWlkVXBUbyI6IjIwMjAtMDYtMTIifSx7ImNvZGUiOiJQUyIsImZhbGxiYWNrRGF0ZSI6IjIwMTktMDYtMTMiLCJwYWlkVXBUbyI6IjIwMjAtMDYtMTIifSx7ImNvZGUiOiJHTyIsImZhbGxiYWNrRGF0ZSI6IjIwMTktMDYtMTMiLCJwYWlkVXBUbyI6IjIwMjAtMDYtMTIifSx7ImNvZGUiOiJETSIsImZhbGxiYWNrRGF0ZSI6IjIwMTktMDYtMTMiLCJwYWlkVXBUbyI6IjIwMjAtMDYtMTIifSx7ImNvZGUiOiJDTCIsImZhbGxiYWNrRGF0ZSI6IjIwMTktMDYtMTMiLCJwYWlkVXBUbyI6IjIwMjAtMDYtMTIifSx7ImNvZGUiOiJSUzAiLCJmYWxsYmFja0RhdGUiOiIyMDE5LTA2LTEzIiwicGFpZFVwVG8iOiI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yow==

https://blog.csdn.net/hi_liuxiansheng/article/details/89078405

你可能感兴趣的:(环境安装)