refactor: The main function and some writes what I think is a better practice #68
refactor: The main function and some writes what I think is a better practice #68uptutu wants to merge 4 commits intobxcodec:masterfrom
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.
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