【发布时间】:2020-02-26 04:23:18
【问题描述】:
在它发生之前,我正在尝试使用 dep 来管理我的 golang 代码依赖项。
我现在发现我无法使用 go 执行任何命令,即使我尝试使用 brew uninstall go 的 brew 卸载它并再次执行 brew install go。
如果我正在执行go env,它将显示如下:
$ go env
go: cannot find GOROOT directory: /usr/local/cellar/go/1.13.1/libexec
$ ls /usr/local/Cellar/go/1.13.8/libexec/
CONTRIBUTING.md SECURITY.md bin lib robots.txt
CONTRIBUTORS VERSION doc misc src
PATENTS api favicon.ico pkg test
$ go version
go: cannot find GOROOT directory: /usr/local/cellar/go/1.13.1/libexec
$ go build
go: cannot find GOROOT directory: /usr/local/cellar/go/1.13.1/libexec
$ echo $GOPATH
/Users/mymac/go
$ echo $GOROOT
$
我应该怎么做和检查?
【问题讨论】:
-
不要通过 brew 安装 Go。使用来自 golang.org 的官方 Go 发行版。并且不要使用 dep。
标签: go command-line-interface homebrew godeps gopath