-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
refactor: The main function and some writes what I think is a better practice #68
base: master
Are you sure you want to change the base?
Conversation
…bring the project closer to the Go project
…bring the project closer to the Go project
What&which "Go project" do you mean? I think there is no standard project layout that initially came from Go / Go authors. |
This is a good question, it is true that there is no official standard, and what I have is simply a style that I think is better, I guess. Like what this repo is showing, or trying to express, I'm just relying on some of the knowledge that I have and doing what I think is a better practice. I am very sorry for my title. This is very careless. |
What do you think about applying the GolangCI linter? |
defer func() { | ||
if err := dbConn.Close(); err != nil { | ||
log.Fatal(err) | ||
} | ||
}() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is not correct, it will close the DB connection immediately when this function is called.
What you can do instead is pass the DBconn as a parameter.
And the DB close function can be called in after the server exit.
Thanks for this repo. I have learnt a lot from it.
I have also tried to modify some of the code to my current knowledge to try to make the whole repository more like a Go project as I know it.
I look forward to discussing some of the relevant changes with you under this PR.
ref: uber-go style guide