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

Tracking errors and properly exiting with error code #37

Merged
merged 1 commit into from
Sep 1, 2020
Merged

Tracking errors and properly exiting with error code #37

merged 1 commit into from
Sep 1, 2020

Conversation

jschell12
Copy link
Contributor

Ensure errors tracked to later exit properly with error code (1)
(wip)

@sendqueery sendqueery self-requested a review August 19, 2020 16:36
.gitignore Outdated Show resolved Hide resolved
func (results *ResultSafe) Add(result *Result) {
results.Lock()
results.InvocationResults = append(results.InvocationResults, result)
results.Unlock()
Copy link
Contributor

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?

Copy link
Contributor

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 {
Copy link
Collaborator

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?

Copy link
Contributor Author

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

@sendqueery sendqueery merged commit e65ae5e into disneystreaming:v1 Sep 1, 2020
sendqueery pushed a commit that referenced this pull request Sep 3, 2020
Co-authored-by: Josh Schell <joshua.schell@disneystreaming.com>
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.

4 participants