1、在mac终端安装go
在go 官方网站下载mac版本的go,安装完成后在中断运行go version和 go env确认go安装好了
例如我的:
alisadeMacBook-Pro:~ root# go version
go version go1.15.3 darwin/amd64
alisadeMacBook-Pro:~ root# go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/var/root/Library/Caches/go-build"
GOENV="/var/root/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/var/root/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/var/root/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.15.3/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.15.3/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build777133695=/tmp/go-build -gno-record-gcc-switches -fno-common"
alisadeMacBook-Pro:~ root#
2、下载安装vscode
查看vscode版本,点击vscode软件左上角的visual studio code查看vscode的版本
或者在帮助中relase note中查看
3、在vscode 中查找setting.json并且配置一些参数,包括自动导入啊等等
点击左侧的小齿轮,然后选setting
其中Setting内容如下