You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The tool could apply this to if-statements as well.
One line if-statements are controversial, and so my code reviewer and I believe that we should leave that choice to the user rather than requiring multi-line if-statements. We already leave this choice to the user in the case of function definitions, and so I was hoping that this wouldn't be much more work than that.
Our motivation for one line if-statements is that something like:
if choice == "" { choice = default }
is less distracting and arguably more readable than:
if choice == "" {
choice = default
}
Thank you!
The text was updated successfully, but these errors were encountered:
ianlancetaylor
changed the title
Proposal: Gofmt to treat one line if-statements as it does one line function definitions.
proposal: cmd/gofmt: treat one line if-statements as it does one line function definitions
Feb 17, 2021
This proposal is a duplicate of a previously discussed proposal, as noted above,
and there is no significant new information to justify reopening the discussion.
The issue has therefore been declined as a duplicate.
— rsc for the proposal review group
Currently, gofmt will change:
into:
The tool could apply this to if-statements as well.
One line if-statements are controversial, and so my code reviewer and I believe that we should leave that choice to the user rather than requiring multi-line if-statements. We already leave this choice to the user in the case of function definitions, and so I was hoping that this wouldn't be much more work than that.
Our motivation for one line if-statements is that something like:
if choice == "" { choice = default }
is less distracting and arguably more readable than:
Thank you!
The text was updated successfully, but these errors were encountered: