https://golang.google.cn/
https://github.com/golang/go/wiki/SettingGOPATH#windows
go 里面有两个非常重要的环境变量 GOROOT 和 GOPATH,其中 GOROOT 是安装 go 的路径,而 GOPATH 是我们定义的自己的工作空间。
setx GOPATH %USERPROFILE%\go
This will set the GOPATH to your [home folder]\go, such as C:\Users\yourusername\go
C:\Users\zhaojq>go env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\zhaojq\AppData\Local\go-build
set GOENV=C:\Users\zhaojq\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\zhaojq\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=c:\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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\zhaojq\AppData\Local\Temp\go-build596256890=/tmp/go-build -gno-record-gcc-switches
文件 -> 首选项 -> 设置,配置用户JSON文件
{
"workbench.colorTheme": "Solarized Dark",
"files.autoSave": "onFocusChange",
"editor.fontSize": 18,
"go.goroot": "C:\\go",
"go.gopath": "C:\\Users\\zhaojq\\go",
"files.exclude": {
"**/.classpath": true,
"**/.project": true,
"**/.settings": true,
"**/.factorypath": true
}
}
go get -u -v github.com/nsf/gocode
go get -u -v github.com/rogpeppe/godef
# 创建 $GOPATH/src/golang.org/x
cd $GOPATH/src/golang.org/x
git clone https://github.com/golang/tools.git
git clone https://github.com/golang/lint.git
# 完成以上步骤后,执行
go get golang.org/x/lint/golint
go get -u -v github.com/lukehoban/go-find-references
go get -u -v github.com/lukehoban/go-outline
go get -u -v sourcegraph.com/sqs/goreturns
go get -u -v golang.org/x/tools/cmd/gorename
go get -u -v github.com/tpng/gopkgs
go get -u -v github.com/newhook/go-symbols
package main
import "fmt"
func main() {
fmt.Println("hello world!")
}