执行sudo go get出现$GOPATH not set的问题
2017-08-26 17:54
267 查看
将
cannot download, $GOPATH not set. For more details see: go help gopath
原因很简单,因为sudo我们使用了root的环境,而我们没有在root的.bashrc文件中设置GOPATH,所以这里有么几个办法:
直接
或者在
或者
GOPATH写入
.bashrc文件之后,执行
sudo go get xxx,出现
cannot download, $GOPATH not set. For more details see: go help gopath
原因很简单,因为sudo我们使用了root的环境,而我们没有在root的.bashrc文件中设置GOPATH,所以这里有么几个办法:
直接
go get xxx即可。
或者在
/etc/profile文件中添加
GOPATH变量。
或者
sudo env GOPATH=/opt/go go get github.com/nsf/gocode,命令里面手动给出GOPATH变量值。
相关文章推荐
- 解决ant编译中出现“includeantruntime was not set”警告的问题
- Ubuntu中出现“E: Could not get lock”问题的解决
- 解决ant编译中出现“includeantruntime was not set”警告的问题
- linux更新出现Could not get lock /var/lib/apt/lists/lock问题解决方法
- 解决ant编译中出现“includeantruntime was not set”警告的问题
- 解决maven打包编译出现File encoding has not been set问题
- 嵌入式 编译gdb源码时出现“set but not used [-Werror=unused-but-set-variable]”问题的解决办
- 解决maven中出现解决-Dmaven.multiModuleProjectDirectory system property is not set的问题
- 解决ant编译中出现“ warning: 'includeantruntime' was not set,”警告的问题执行ant编译时,
- 问题win7 gopath not set
- 解决ant编译中出现“includeantruntime was not set”警告的问题
- 解决ant编译中出现“includeantruntime was not set”警告的问题
- 定义一个以is开头的全局变量利用IDEA的Getter and Setter自动生成get跟set方法出现的问题
- 问题四20150827解决maven打包编译出现File encoding has not been set问题
- STM32F*在线调试时,出现BP could not be set问题解决办法
- Ubuntu上出现无法获得锁“Could not get lock /var/lib/apt/lists/lock”问题的解决
- Maven之—— 打包编译出现File encoding has not been set问题
- apache-ant编译中出现“includeantruntime was not set”警告的问题?
- 新建silverlight项目出现object reference not set to an instance of an object问题
- $GOPATH not set 问题解决方案