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.
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
[0.1] Delete machines #1180
[0.1] Delete machines #1180
Changes from 6 commits
0ff2de4
1b198d7
f8ce245
e109098
76b6839
335c65e
349628c
ac37029
53b6bf6
6b8bb8e
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 don't think we need WithStack and instead we can return err directly because r.listChildren is our function, and it properly wraps/stacks all the errors it returns. WDYT?
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'll be honest, I have no idea what WithStack does, I added it because you suggested it a few blocks up
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 guess you only need to add it once?
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.
By default, errors in Go do not include any stack trace information. Without it, it makes it very difficult to determine the source of an error (i.e. source code file & line), especially if the same error can be created in multiple places. github.com/pkg/errors makes it much easier to embed that stack information, and it includes a special custom format printer to print out the stack trace information.
The general guidance I've used in the past is that every line of code you write in a project that returns an error must either already have stack info, or you must wrap it. For first class functions (those defined in your project), you can/should assume that any errors they return are already wrapped. When you are invoking functions from vendored libraries, you can either check to see if they use github.com/pkg/errors, or you can just wrap.
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.
Should we aggregate all errors in this for loop so we can try to delete as much as we can?
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.
The deletion happens in a later step, I think Accessor is unlikely to fail. But it might be a good idea to aggregate the errors for the actual deletion loop
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 agree that Accessor is unlikely to fail, but I'd still like to include it in errList instead of returning early.
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 think this is my only remaining comment