-
Notifications
You must be signed in to change notification settings - Fork 24
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
Tracking errors and properly exiting with error code #37
Conversation
func (results *ResultSafe) Add(result *Result) { | ||
results.Lock() | ||
results.InvocationResults = append(results.InvocationResults, result) | ||
results.Unlock() |
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.
Unimportant potentially bikesheddy question so take worth a grain of salt, do we prefer defer
for these kinda ops?
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.
I generally prefer using defer but considering the proximity and how simple this function is I am impartial to its use here. When there is more code between the lock and unlock I think defer is always the best option
@@ -114,12 +114,18 @@ func runCommand(cmd *cobra.Command, args []string) { | |||
// Output our results | |||
log.Infof(resultFormat, "Instance ID", "Region", "Profile", "Status") | |||
for _, v := range output.InvocationResults { | |||
switch v.Status { |
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.
Is there a particular reason to move away from the switch/case statements?
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.
Jordan and I paired on this. Not sure why I made the change either
Co-authored-by: Josh Schell <joshua.schell@disneystreaming.com>
Ensure errors tracked to later exit properly with error code (1)
(wip)