refactor: remove redundant else branches - #344
Conversation
| } | ||
|
|
||
| os.Remove(templatePath) | ||
| os.Remove(logfile) |
There was a problem hiding this comment.
I feel we would like to keep the two temporary files in case of test failures as they could help the users debug the failed test better.
Same goes for the change in acctest/provisioneracc/provisioners.go
There was a problem hiding this comment.
Good catch on the intent to keep the template and log on failure for debugging (the Fatalf message points at those paths for that reason).
Behaviorally this is unchanged: t.Fatalf never returns (FailNow / runtime.Goexit), so the os.Remove calls after the if only run on success. Same for provisioners.go. Dropping the else after a terminating statement is the usual Go early-exit idiom.
Happy to restore the else in both places if you prefer that form to make the “cleanup only on success” intent more obvious at a glance.
Removes unnecessary `else` clauses after terminating statements. Signed-off-by: Ryan Johnson <ryan@tenthirtyam.org>
7aefca9 to
a8045c1
Compare
Description
Removes unnecessary
elseclauses after terminating statements.Resolved Issues
Redundant
elseclauses inifstatements that contain areturn.Rollback Plan
Revert commit.
Changes to Security Controls
None.