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 main.go #2763
Refactor main.go #2763
Conversation
6ab9d65
to
9ac347a
Compare
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.
👍🏻
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.
Really satisfying to see all that code taken out of main 👍
9ac347a
to
66ac6bb
Compare
Codecov Report
@@ Coverage Diff @@
## main #2763 +/- ##
==========================================
+ Coverage 53.66% 53.74% +0.08%
==========================================
Files 52 55 +3
Lines 14862 15085 +223
==========================================
+ Hits 7975 8108 +133
- Misses 6621 6707 +86
- Partials 266 270 +4
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
e07ec92
to
e547b78
Compare
e547b78
to
2e3b8f8
Compare
* Create separate flag file * Move our Prometheus logic into separate functions * Move out gc and sm logic into separate functions * Move most logic from main.go to separate functions * split parseFlags a bit * Remove redundant test * Move getBuildInfo to utils.go * Move if statement
Proposed changes
Initial refactor of main.go. This pass doesn't remove any code or really change any of the functionality, just splits logic into functions for make it easier to read and understand. It also removes all the flag parsing logic to a separate flags.go file.
It also removes the getCommitInfo test as it wasn't working as expected anyway (it should have broken with the recent change to using the go binary to get the commit info but it wasn't getting the correct string)
The complexity before and after is:
Checklist
Before creating a PR, run through this checklist and mark each as complete.