Golang安裝、配置及IDE
原文更多內(nèi)容可參見:http://blog.hyrscloud.com/topic/index?id=18
下載地址
Golang 官網(wǎng)地址:https://golang.org/dl/劣摇,通過翻墻后才可訪問吃靠。
Golang 官網(wǎng)地址:https://golang.google.cn/dl/,國(guó)內(nèi)可以訪問的渊抄。
或者通過:https://studygolang.com/dl尝胆,下載安裝包。
Go語言中文網(wǎng):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環(huán)境變量
<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 //指定系統(tǒng)的體系架構(gòu)渣慕,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的目錄逊桦,這個(gè)目錄不能在Go的安裝目錄中眨猎,可隨意指定,通過go get下載其他項(xiàng)目的源碼或包時(shí)會(huì)自動(dòng)存放在該目錄
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
個(gè)人推薦大家使用 LiteIDE强经,來編寫 golang 代碼睡陪。
LiteIDE 是一款國(guó)人開發(fā)的、簡(jiǎn)單匿情,開源兰迫,跨平臺(tái)的 Go IDE,使用QT開發(fā)的炬称,編譯的快捷鍵與QT Creator基本一致汁果。
LiteIDE的使用參考:http://www.reibang.com/p/da14d9683f9a
LiteIDE可以通過界面選擇交叉編譯,http://liteide.org/cn/documents/ 有關(guān)交叉編譯的使用玲躯,liteide作者介紹的很清楚据德。