Kitgen generated code confusion
When running kitgen on the listed code, I get the following error:
/main.go:3:6: StringService redeclared in this block
previous declaration at ./gokit.go:10:6
I am running kitgen --repo-layout flat ./main.go
package stringsvc
type StringService interface {
Count(s string) int
Uppercase(s string) (string, error)
}
I think this is related to #639, as I don't there is a full example of how you are meant to use kitgen.
Edit: Removed misleading additional errors.
I think it's not clear and I agree that it's not really usable (there should be some validation), but your functions should get as input a context.Context.
This works:
package main
import "context"
type StringService interface {
Count(ctx context.Context, s string) (int, error)
Uppercase(ctx context.Context, s string) (string, error)
}
@Raffo Your right about context being an issue. I have removed that from my original post since it is misleading to the question I have. This is a follow-up issue from a comment on #639, when running kitgen as suggested as the README, it generates invalid code. The interface for the service and the generated service struct both share the name in the same package.
This seems like it is an issues when providing --repo-layout flat as the package is set to the same as the file containing the interface for the service. When calling kitgen without --repo-layout packages is set to http, endpoint and service for the generated files.