Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generation not successful with custom type #57

Open
Raffo opened this issue Mar 25, 2018 · 1 comment
Open

Generation not successful with custom type #57

Raffo opened this issue Mar 25, 2018 · 1 comment

Comments

@Raffo
Copy link
Contributor

Raffo commented Mar 25, 2018

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?

@vetcher
Copy link
Contributor

vetcher commented Mar 25, 2018

Your problems is actually bug #13 and I does not know right way, how to fix it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants