1.5到1.6:不允许导入周期

I'm trying to migrate from Go 1.5.3 to Go 1.6 and for some packages I encounter "import cycle not allowed" error, when I'm trying to build them for 1.6 .

e.g for building the golint tool I'm getting:

import cycle not allowed
package github.com/golang/lint/golint
    imports flag
    imports errors
    imports runtime
    imports runtime/internal/atomic
    imports runtime

Is there eny problem in my local env or is there any way how to fix this?

go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/radek/Projekty/Go"
GORACE=""
GOROOT="/home/radek/Software/Go/go1.6"
GOTOOLDIR="/home/radek/Software/Go/go1.6/pkg/tool/linux_amd64"
GO15VENDOREXPERIMENT=""
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"

I had this happen to me the other day. It had something to do with my environment variables being setup wrong.

do go version and check that you are building with the expected go distribution.

If it's not the version you were expecting, make sure you update your $GOROOT and or $GOPATH variables to the correct settings.

https://golang.org/doc/install

This error is what is shown when there is a package importing itself. For example, in $GOPATH/src/github.com/myawesome/mistakes, you have a file that like this:

package mistakes

import (
    "github.com/myawesome/mistakes"
)

func CreateComplicatedBugFromSimpleMistake(m mistakes.Mistake) {
    // done.
}

That was what I was doing. You should know how to solve it, if this is your case too.

Compare the output of readlink -f $(which go) and echo $GOROOT and if they are different, you should set $GOROOT to point to the root directory of the go binary you are running or vice versa.