microgen
microgen copied to clipboard
Generation not successful with custom type
If I use the following service.go
file:
package service
import "context"
type Cluster struct {
Name string
URL string
}
// @microgen middleware, logging, main, http
type StringService interface {
// @http-method GET
ListCluster(ctx context.Context) (cluster []*Cluster, err error)
CreateCluster(ctx context.Context, cluster *Cluster) (err error)
GetCluster(ctx context.Context, name string) (cluster *Cluster, err error)
}
And generate the code with microgen service.go
, I get code that doesn't compile:
go build .
# test/foo/middleware
../../middleware/logging.go:27:69: undefined: Cluster
../../middleware/logging.go:38:68: undefined: Cluster
../../middleware/logging.go:49:79: undefined: Cluster
../../middleware/logging.go:63:14: undefined: Cluster
# test/foo/transport/converter/http
../../transport/converter/http/exchange_converters.go:64:2: req declared and not used
This is due to some changes that were done in the past, in particular Cluster
is missing the right package. I wanted to fix those and actually it wouldn't be so complicated I guess, I could probably submit a PR. I wonder though how we can avoid this from happening again with an adequate test suite, like mentioned in #56 . Any ideas?
Your problems is actually bug #13 and I does not know right way, how to fix it