Skip to content
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

Rewrite if-else-if-else to switch statements #921

Merged
merged 1 commit into from
Mar 4, 2020

Conversation

sosiska
Copy link
Contributor

@sosiska sosiska commented Mar 13, 2019

This commit rewrites some if-else-if-else chains as a switch.
Based on Go style guide:
https://golang.org/doc/effective_go.html#switch

Found by https://go-critic.github.io/overview#ifElseChain-ref

@dgsb
Copy link
Collaborator

dgsb commented Mar 15, 2019

I'm not such fan of mixing if and switch control structure.
I'm not such fan either of using switch for something else than value or range value comparison.

@sosiska
Copy link
Contributor Author

sosiska commented Mar 15, 2019

I'm not such fan of mixing if and switch control structure.
I'm not such fan either of using switch for something else than value or range value comparison.

I can return if-else, but in isColored() func we can squash 2 checks into one with ||, because they doing one thing - isColored = false.

@sosiska
Copy link
Contributor Author

sosiska commented Mar 17, 2019

Ping.

@sosiska
Copy link
Contributor Author

sosiska commented Mar 30, 2019

Ping

@dgsb
Copy link
Collaborator

dgsb commented Apr 2, 2019

@sosiska yes we can merge the two branches together if you want

@sosiska
Copy link
Contributor Author

sosiska commented Apr 5, 2019

@sosiska yes we can merge the two branches together if you want

I do not quite understand you 🤔, but i like current variation of code state.

@sosiska
Copy link
Contributor Author

sosiska commented May 8, 2019

Ping

@stale stale bot added the stale label Feb 26, 2020
@markphelps markphelps removed the stale label Feb 26, 2020
Repository owner deleted a comment from stale bot Feb 26, 2020
@markphelps markphelps merged commit 53000c4 into sirupsen:master Mar 4, 2020
cgxxv pushed a commit to cgxxv/logrus that referenced this pull request Mar 25, 2022
Rewrite if-else-if-else to switch statements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants