CLEANUP: environment-check: dependent executables error logic refactored#55
Merged
aiharos merged 1 commit intohaproxytech:masterfrom May 26, 2020
Merged
Conversation
haproxy/haproxy_cmd/run.go
Outdated
| } | ||
| func() { | ||
| ensureVersion(haproxyBin, "^HA-Proxy version ([0-9]\\.[0-9]\\.[0-9])", "2.0", 0) | ||
| go func() { |
Collaborator
There was a problem hiding this comment.
Nitpick: this can be just go ensureVersion(...)
Collaborator
Author
There was a problem hiding this comment.
Sure, thanks :) Updated
Collaborator
|
I just left a small nitpick comment since the goal is cleaning up. LGTM |
Collaborator
|
I just noticed that the original code for this is wrong. The lambda hardcodes the version number instead of using the argument and strings.Compare won't work for versions like |
Collaborator
Author
|
I found there is a library for comparing versions: https://github.com/hashicorp/go-version. If you wish, I can open another PR to address this issue? |
Collaborator
|
Sure :) |
ShimmerGlass
approved these changes
May 20, 2020
Since only one error is captured, there is no need for `make([]error, 2)` and index logic. Instead, last error is captured and returned. Additionally, `sync.WaitGroup` exists, but there was no goroutines spawned. So, added `go` keyword to spawn goroutines.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since only one error is captured, there is no need for
make([]error, 2)and index logic.Instead, last error is captured and returned.
Additionally,
sync.WaitGroupexists, but there was no goroutines spawned.So, added
gokeyword to spawn goroutines.