Skip to content

[REQ] Improve go-gin-server template #7280

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

Open
ash-r1 opened this issue Aug 24, 2020 · 6 comments
Open

[REQ] Improve go-gin-server template #7280

ash-r1 opened this issue Aug 24, 2020 · 6 comments

Comments

@ash-r1
Copy link

ash-r1 commented Aug 24, 2020

Hi, I'm gopher, as others already mentioned, go-gin-server has several issues.
I want to make points clear in this issue and discuss it.

Below is my suggestion as a gopher.

  • Locate source codes on the root (instead of under go directory)
  • Use separated package for controller or model.
  • Controller's implementation which based on request/response definition.
    • Bind body with shouldBind or get parameter with getParam etc...
    • Return success/error with the corresponding HTTP status and response body.
  • Defined routes with basic methods. Do not use the weird Route struct.
  • (Advanced) Add controller struct and define action methods for struct pointers.
    • By using controller struct, it's easier to initialize middleware in server bootstrapping.

I have my custom generator to achieve these points on my local already. I can refine it and make a PullReq if someone needs it.

Is it should have the same name or another? go-gin-server2?

Please give me advice and opinion.

I think it's related to #1931 and #2752, #2803. But I filed this issue because these are somewhat outdated.

@wing328
Copy link
Member

wing328 commented Aug 27, 2020

Is it should have the same name or another? go-gin-server2?

The upcoming 5.0.0 version (major release) allows breaking change so we can include your changes into go-gin-server directly. Just that we need to highlight the breaking changes in the PR description to make people aware of these.

I would suggest filing small PRs to target the requested features one by one to allow easier review and faster merge.

@ash-r1
Copy link
Author

ash-r1 commented Aug 27, 2020

@wing328 Thank you for your reply.

The upcoming 5.0.0 version (major release) allows breaking change

Good!

I would suggest filing small PRs to target the requested features one by one to allow easier review and faster merge.

Okay, I'll focus on one thing by one PR as much as I can.

@hkawa608
Copy link

@ash-r1
I want your PR. How is it going?

@khizunov
Copy link

khizunov commented Oct 3, 2023

@wing328 I would like to propose new template of gin server, can I take this issue? I already have the implementation just need to open a PR.

@wing328
Copy link
Member

wing328 commented Oct 3, 2023

yes please

@ash-r1
Copy link
Author

ash-r1 commented Oct 4, 2023

I'm so sorry for ignoring the message.

I hope @khizunov will do better 👍, Thanks.

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

No branches or pull requests

4 participants