macOS 简单配置Go环境

安装golang

➜  ~ brew install go
➜  ~ go version # 安装完成
go version go1.10.1 darwin/amd64

配置golang环境变量

GOPATH必须设置,GOBIN 非必须

cat .zshrc
GO_LIB_PATH=/Users/ysicing/Work/Gorepo/golib
GO_LIB_BIN_PATH=${GO_LIB_PATH}/bin
GO_WORK_PATH=/Users/ysicing/Work/Gorepo/gowork
GO_WORK_BIN_PATH=${GO_WORK_PATH}/bin
export GOPATH=${GO_LIB_PATH}:${GO_WORK_PATH}
export GOBIN=${GO_LIB_BIN_PATH}:${GO_WORK_BIN_PATH}
export PATH=$HOME/bin:/usr/local/bin:${GOBIN}:$PATH

配置完需要source .zshrc生效

安装delev工具

# 安装 delev 工具:
brew install go-delve/delve/delve
# 安装完成
➜  ~ dlv version
Delve Debugger
Version: 1.0.0
Build: v1.0.0

其中遇到问题 感谢@MichaelIT

actually I did this:
cd $HOME/Library/Caches/Homebrew
tar xf delve-*.gz
go into directory ( mine is delve-1.0.0-rc.1 )
sh scripts/gencert.sh
it will asks for password, and you're done.
After that just re run brew install go-delve/delve/delve
and it will pass without problems
run this before brew install go-delve/delve/delve work for me

配置vscode

    "go.gopath": "/Users/ysicing/Work/Gorepo/golib:/Users/ysicing/Work/Gorepo/gowork",
    "go.goroot": "/usr/local/Cellar/go/1.10.1/libexec",