Aage
Aage

Reputation: 6252

"import cycle not allowed" while running test in golang example

I'm trying to setup tests for my functions in golang, but getting the following error while running go test ... from the console:

import cycle not allowed package runtime imports unsafe imports runtime

Thinking that it was me I cloned the golang example project and ran go test reverse_test.go, but getting the same error. Both my GOPATH and GOROOT environment values are set to C:\go, where I installed Go. I'm on a Windows 8.1, 64bit machine.

Any ideas what's wrong?

Upvotes: 3

Views: 5373

Answers (1)

VonC
VonC

Reputation: 1324347

Make sure to do a "go get github.com/golang/example/hello" (as mentioned in github.com/golang/example) once your GOPATH is set to a proper path.

See "How to Write Go Code":

The GOPATH environment variable specifies the location of your workspace. It is likely the only environment variable you'll need to set when developing Go code.

You should see your github/golang/example inside $GOPATH/src

Upvotes: 3

Related Questions