Why aren’t my test running?
The command go test
will only pick up tests in the directory that the command is being run in. To have it find tests in sub-folders, try the command go test ./...
. This searches recursively through the sub-folders and finds the hiding tests and runs them.
Tests still aren’t running? If you are using godep to manage dependancies, you can try:
godep get
Still getting error messages á la:
somefolder/some_test.go:10:2: cannot find package "github.com/THING/code" in any of: /usr/local/Cellar/go/1.5.1/libexec/src/github.com/THING/code (from $GOROOT) ~/code/go/src/github.com/THING/code (from $GOPATH)
Try the following series of commands from the root directory of your project.
godep restore rm -rf Godeps godep save ./... godep go test ./... go test ./...
Stay tuned for an actual explanation of why any of this works when I figure it out!