go: cannot use path@version syntax in GOPATH mode

安装插件报错

>go get k8s.io /klog@v1.0.0 go: cannot use path@version syntax in GOPATH mode

go: cannot use path@version syntax in GOPATH mode

查看环境变量

>go env
set GO111MODULE=off   <===新特性已被关闭
set GOARCH=amd64

解决

>go env -w GO111MODULE=auto

成功安装

>go get github.com/go-logr/logr@v0.1.0
go: downloading github.com/go-logr/logr v0.1.0
posted @ 2021-07-13 14:30  flytoyou  阅读(1152)  评论(0编辑  收藏  举报