1.安装GO环境
从https://studygolang.com/dl下载go1.14.6.windows-amd64.msi安装即可,安装路径选择默认,安装完成后会自动帮你配置环境变量不用自己配置了
2.打开vscode配置代理
问题:vscode无法安装go依赖包
解决:
在vscode的TERMINAL终端中输入
go env -w GO111MODULE=on
go env -w GOPROXY=https://proxy.golang.com.cn,direct
设置完代理后就可以安装vscode提示需要安装的包。
3.初始化go.mod
问题:go: go.mod file not found in current directory or any parent directory; see ‘go help modules’ (exit
解决:
在vscode的TERMINAL终端中输入
PS F:\j\tool\python\workspace\GO> go mod init github.com/Spyder-man-0814/gowork
go: creating new go.mod: module github.com/Spyder-man-0814/gowork
go: to add module requirements and sums:
go mod tidy