golang升级后提示import cycle not allowed

$ go get github.com/golang/protobuf/proto
import cycle not allowed
package github.com/golang/protobuf/proto
imports bufio
imports bytes
imports errors
imports runtime
imports runtime/internal/atomic
imports runtime

如果升级之前是好的,但是升级之后提示这个错误,那么就很有可能是这个问题

产生的原因是 PATH 中 GOROOT 没有修改、没有刷新、写错了(尾部不能有斜杠)

可以用 go version 来检查一下版本是否正确


vim ~/.profile
source ~/.profile

或者

vim /etc/profile
source /etc/profile


#export GOROOT=/mnt/xvdb/home/fly/soft/go-release-branch.go1.4/
export GOROOT=/home/fly/soft/go-release-branch.go1.6/

export PATH=$PATH:$GOROOT/bin

#export GOPATH=/home/fly/thriftgo
#export GOPATH=/home/fly/go/product/src/go_mqtt
export GOPATH=/home/fly/go/product/src/grpc
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOPATH/bin

猜你喜欢

转载自tangxiongfeiphp.iteye.com/blog/2341876