One structure I was trying to use was:
./app./app/app.go./module./module/interface.go./module/implementation1./module/implementation1/implementation1.go./module/implementation2./module/implementation2/implementation2.go
./app/app.go has something like:
package app
import "../module"
import "../module/implementation1"
var instance module.Interface = implementation1.New()
and ./module/interface.go has something like:
package module
type Interface interface {
// omitted
}
and ./module/implementation1/implementation1.go has something like:
package implementation1
import "../../module"
func New() module.Interface {
// omitted
}
I could change ./module to ./app/module, which make one part of it work. It would also make code structure ridiculous, since, if I had another package, ./module2, that imports ../module1, then I'd have to structure it as ./app/module2/module. And if I had a third module that also imports ../module, then I'd need ./app/module2/module3/module or ./app/module3/module2/module, which is the case of ./module/implementation1 and ./module/implementation2. And it gets worse with more packages. Perhaps it's expected that AppEngine code should all be lumped into a single package, which is horrible.
No comments:
Post a Comment