Golang安装、配置及IDE
原文更多内容可参见:http://blog.hyrscloud.com/topic/index?id=18
下载地址
Golang 官网地址:https://golang.org/dl/,通过翻墙后才可访问。
Golang 官网地址:https://golang.google.cn/dl/,国内可以访问的。
或者通过:https://studygolang.com/dl,下载安装包。
Go语言中文网:https://studygolang.com/
下载安装包,按照提示安装即可。
判断是否安装成功
<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="" cid="n8" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 4px 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">C:\Users\zhang>go version
go version go1.15.5 windows/amd64</pre>
Go环境变量
<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="" cid="n10" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 4px 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">C:\Users\zhang>go env
set GO111MODULE=
set GOARCH=amd64 //指定系统的体系架构,386、amd64、arm
set GOBIN=
set GOCACHE=C:\Users\zhang\AppData\Local\go-build
set GOENV=C:\Users\zhang\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\zhang\go //用于存放Go语言的Package的目录,这个目录不能在Go的安装目录中,可随意指定,通过go get下载其他项目的源码或包时会自动存放在该目录
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=c:\go //go的安装目录
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\zhang\AppData\Local\Temp\go-build962120078=/tmp/go-build -gno-record-gcc-switches
C:\Users\zhang></pre>
IDE
这有一篇介绍 Golang IDE 的文章:https://zhuanlan.zhihu.com/p/64262831
个人推荐大家使用 LiteIDE,来编写 golang 代码。
LiteIDE 是一款国人开发的、简单,开源,跨平台的 Go IDE,使用QT开发的,编译的快捷键与QT Creator基本一致。
LiteIDE的使用参考:https://www.jianshu.com/p/da14d9683f9a
LiteIDE可以通过界面选择交叉编译,http://liteide.org/cn/documents/ 有关交叉编译的使用,liteide作者介绍的很清楚。