-
Notifications
You must be signed in to change notification settings - Fork 828
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
Shrink main func to resolve gocyclo warning #207
Conversation
Build Succeeded 👏 Build Id: 1ba7c0f0-573d-464e-9900-4c25822fd1a9 The following development artifacts have been built, and will exist for the next 30 days:
|
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.
LGTM
Rebased onto master for a clean merge. |
Build Succeeded 👏 Build Id: 8cee3803-148b-4000-89ee-549b6e0e8279 The following development artifacts have been built, and will exist for the next 30 days:
|
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.
Approved! Just one question for my own curiosity,
@@ -50,7 +49,7 @@ func main() { // nolint: gocyclo | |||
} | |||
|
|||
log.Print("Starting Health Ping") | |||
stop := make(chan bool) | |||
stop := make(chan struct{}) |
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.
Just for my own curiosity - why the change? Because it more closely matches context.Context
and some of the Kubernetes constructs?
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.
Since stop
is used purely as a signalling mechanism, and not as a way to transport meaningful information, I have followed the Go idiom of using struct{}
, which indicates the value is of no meaning in and of itself. On the other hand, bool
suggests we might send true
or false
, when in fact we don't really care about either.
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.
Thanks! That makes perfect sense!
Build Failed 😱 Build Id: 77855fb2-87ff-4b09-873d-05e7247d5690 Build Logs
|
Fixes #178
This is the simplest fix to the gocyclo linter error: breaking out functions of related code. I propose taking the same approach for #177.