打开zshrc文件
vim ~/.zshrc
输入变量
export GOPATH="/Users/chennan/go" #这个自定义
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOBIN
编译
source ~/.zshrc
打印环境变量
go env
然后可以安装gopm
go get -v -u github.com/gpmgo/gopm
通过gopm安装
gopm get -g -v golang.org/x/text
开始下载
[GOPM] 04-14 22:25:43 [ INFO] App Version: 0.8.8.0307 Beta
[GOPM] 04-14 22:25:43 [ INFO] Local repository path: /Users/chennan/.gopm/repos
[GOPM] 04-14 22:25:43 [ INFO] Indicated GOPATH: /Users/chennan/go
[GOPM] 04-14 22:25:43 [ INFO] Downloading package: golang.org/x/text@branch:<UTD>
[GOPM] 04-14 22:26:08 [DEBUG] Linking golang.org/x/text...
[GOPM] 04-14 22:26:08 [ INFO] Got golang.org/x/text@branch:<UTD>
[GOPM] 04-14 22:26:08 [ INFO] 1 package(s) downloaded, 0 failed
通过idea查看结果
如下图
其他的包安装
gopm get -g -v golang.org/x/net/html