我是 Golang 新手,我正在关注本教程 https://golang.org/doc/tutorial/getting-started 但由于某种原因,我每次尝试运行代码时都会收到此消息:
$GOPATH/go.mod exists but should not
我试图查看这样的答案:https://stackoverflow.com/a/62062562/9785222但我不明白什么是 GOPATH 以及它在哪里。
我在 Linux Fedora 上使用 Vi 作为编辑器
GOPATH 在 Unix 上默认为 $HOME/go。
删除文件 $HOME/go/go.mod 或显式将 $GOPATH 设置为其他目录。
$GOPATH
src
/usr/local/go/src
export $GOPATH=/usr/local/go/src
什么是 GOPATH?
GOPATH 是一个定义文件夹的变量,
GO