首页 > 解决方案 > 在 Ubuntu 16.04 中出现 GOPATH 错误“go: cannot use path@version syntax in GOPATH mode”

问题描述

我无法go get git@github<user/repo>在我的$GOPATH文件夹中运行。收到此错误:

go: 不能在 GOPATH 模式下使用 path@version 语法

我只是想了解为什么go get即使$GOPATH在安装过程中进行了配置也无法正常工作。环境是ubuntu。

~/$ echo $GOPATH
/home/user/go

标签: gogopath

解决方案


I had the same issue and solved setting specific env variable export GO111MODULE=on in my .zshrc(or .bashrc depending on which shell you use) and restart the shell in order to enable modules. You can find more details here: https://github.com/golang/go/wiki/Modules


推荐阅读