syntax: replace if-else chains with expr switch stmt - #254
Merged
Conversation
Usually this form is considered more idiomatic. I've left if-else chains with init statements untouched to less obvious changes. Found with `elseif` check from go-critic linter.
mvdan
reviewed
Jun 23, 2018
mvdan
left a comment
Owner
There was a problem hiding this comment.
Please check that the benchmarks don't get affected by this. Especially the parser, as touching the lexer code can lead to noticeable slowdowns.
Contributor
Author
|
Sure thing. Seems there is hardly any changes at all ( |
Owner
|
Great, thanks. I presumed so, but you never know. |
qiangli
pushed a commit
to qiangli/sh
that referenced
this pull request
Jun 25, 2026
[weave-context] issue: mvdan#254 sh: sh-func + arith ROOT-CAUSE (codex) files: interp/api.go, interp/issue254_fidelity_test.go, interp/runner.go, interp/vars.go commits-ahead: 0 verify: exit=0
qiangli
added a commit
to qiangli/sh
that referenced
this pull request
Jun 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Usually this form is considered more idiomatic.
I've left if-else chains with init statements untouched
to less obvious changes.
Found with
elseifcheck from go-critic linter.