Skip to content
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

main.go fixes and improvements #24

Merged
merged 9 commits into from
Jan 6, 2021

Conversation

invidian
Copy link
Contributor

@invidian invidian commented Jan 6, 2021

Description

Spotted some growing complexity in #8 so I decided to refactor things a bit to make main() shorter. Also #8 implicitly changes logger from zap to klog, so did that here explicitly instead.

Why is this needed

Fixes: #23

How Has This Been Tested?

Build and run binary locally.

How are existing users impacted? What migration steps/scripts do we need?

Checklist:

I have:

  • updated the documentation and/or roadmap (if required)
  • added unit or e2e tests
  • provided instructions on how to upgrade

So first group is standard library as it was previously, then we have
external imports and module-local imports as third group.

Signed-off-by: Mateusz Gozdek <[email protected]>
If description exeeds line length limits of lll linter, then move it to
another line.

Signed-off-by: Mateusz Gozdek <[email protected]>
So only pointer fields must be declared independently.

Signed-off-by: Mateusz Gozdek <[email protected]>
Logger complains about odd number of arguments given to Error function.

Signed-off-by: Mateusz Gozdek <[email protected]>
To make main() shorter.

Signed-off-by: Mateusz Gozdek <[email protected]>
Signed-off-by: Mateusz Gozdek <[email protected]>
As klog is a standard logger for Kubernetes controllers which should be
used.

Signed-off-by: Mateusz Gozdek <[email protected]>
To again make main() shorter and to give this piece of code a name.

Signed-off-by: Mateusz Gozdek <[email protected]>
@detiber detiber merged commit 0641664 into tinkerbell:main Jan 6, 2021
@invidian invidian deleted the invidian/main-cleanups branch January 6, 2021 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor main function
2 participants