I have followed the instructions to the letter on a Ubuntu 12.04 install. I can withmock go test scenarios in the withmock source code.
What I can't seem to do is test when the source directory isn't within the $GOPATH\src directory. This is unfortunately the usual case with Google App Engine go apps (which would benefit immensely from the ability to mock external services).
Here's an example to reproduce:
example.go
package example
import "fmt"
func PrintIt(a int) {
fmt.Println("Got a", a)
}
I have followed the instructions to the letter on a Ubuntu 12.04 install. I can withmock go test scenarios in the withmock source code.
What I can't seem to do is test when the source directory isn't within the
$GOPATH\src
directory. This is unfortunately the usual case with Google App Engine go apps (which would benefit immensely from the ability to mock external services).Here's an example to reproduce:
example.go
example_test.go
Put this in
$GOPATH/src/example
andwithmock go test
should work. Take theexample
dir outside, and it errors out with