I have a problem of testing my GAE golang app uses local packages. The probject looks something like this.
.
├── app.yaml
├── main.go
└── handler
└── handler.go
handler
package is imported in main.go
.
package main
import "handler"
Everything (e.g., goapp serve
) works fine until I started writing tests.
goapp test
complains that handler
package is not found. Seems like GOPATH
of goapp serve
and goapp test
are different. One solution I found is to put
handler
package outside of the project path and import it with fully
qualified name (e.g., github.com/.../handler
) but it doesn't make sense to me
to split the project in to separate places where they're tightly coupled. Are
there any good way to use and test local packages?
Following resources are found on this topic.