Fix unidiomatic error handling, unchecked errors, and other unidiomatic code#113
Fix unidiomatic error handling, unchecked errors, and other unidiomatic code#113leofleeo wants to merge 8 commits intopelican-dev:mainfrom
Conversation
|
Will you also change all the remaining |
Yes, I will, I was just done for the day, that's why it's still a draft |
|
This PR will now also fix code issues brought to my attention by golangci-lint |
There was a problem hiding this comment.
I don’t see any use in exporting test specific function thus i think we should revert 74abfc1
The function was already exported and used in different areas of the code I believe. One of the types it returned was not exported, and in go, it is always good practice to have all return types of an exported function be exported as well so if other packages use the function they can actually make use of the data that was returned. |
Check errors that are unchecked, and remove calls to panic. According to go documentation, panic should NOT be used in production. https://go.dev/doc/effective_go#panic (this same bad error handling is present in pterodactyl, and the commits where it was introduced are originally from pterodactyl, this is not pelican's fault)