Closed vetcher closed 4 years ago
WOW! IMHO, the generator is very good. @peterbourgon What do you think about it? :-)
Looks cool! Can you maybe commit the output of running microgen on the example svc? It would make it easier to see what you get :)
@Vetcher I checked it and it looks cool, I like the idea. I found a couple of issues and I opened the relative GH issues to track them. It would be cool to understand the workflow around this tool, what we can edit, what we can customize, how do you think we should work with it.
@Raffo In @devimteam projects we use microgen in 3 cases:
In this way, the workflow looks like:
microgen
main.go
microgen
main.go
At this moment, microgen not supports customization, except logging middleware and @grpc-addr
and @protobuf
tags, which are really can't be named Customization. In my humble opinion, microgen should provide best-practice code as many as it can without editing, so enhancements to code style or any ideas are welcome.
The answer to your question what we can edit in generated code
is what you want. Microgen tries to describe future behavior in file comments.
Correct me if I understand your questions wrong.
My question was mostly regarding subsequent generation after the first one, plugging custom middlewares in the main and so on.
If I understand correctly, the suggestion is that we keep the interface and structs of the main business logic together in the same file and then generate all the boilerplate with microgen service.go
.
Another thing that I see we should customize are http response codes and I am not sure how they are handled in microgen (haven't checked yet).
Microgen does not overwrites main.go
if it exist, so you may change it as you want. Behavior is different for each tag(file), I tried to describe it in tags section.
Struct, which implements interface, and it's methods are just an entry point to business logic. Also, in most common cases, you don't want to create 2 or more implementations of your API, so keep interface and it's single implementation together is good idea, imho.
Hi, the Go-kit and Gokit-Cli are both great jobs, they are widely used in our team. And I have updated Gokit-CLi for go module support and continue to maintain it with the go-kit and golang features in the future. https://github.com/GrantZheng/kit/releases/tag/v1.0.0
Hi, could you look at small tool for generate microservices and write your thoughts about it?