Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First, with Go 1.14, the use of `%w` in a Printf context other than Errorf causes a vet error. `%w` is a special trigger to Errorf to create a "wrapped" error. What you'd want to do instead is either `%s` or `%v`. However, given the nature of error strings, the behavior of simply concatenating them together to `w` seems inappropriate. If anything, they should at least occur on seperate lines, so Fprintln seems more appropriate. Second, RunIfError's comment and invocation in Exec made apparent another bug. As written, the undo stack would never actually execute. As directed, if you were to: defer undoStack.RunIfError(out, err) ...every value is evaluated at the point of `defer`, but the execution of the function is what is actually deferred. `err` will be `nil` there, and thus the undo stack is never actually executed. This simple fix there is to actually defer a closure. When an error is returned, it will then be observable from within the closure.
- Loading branch information