(SCC-S1034) Use result of type assertion to simplify cases
Closed this issue · 0 comments
n3m commented
Description
Instead of asserting the type everytime in a switch-case block, assign the result of type assertion to another variable and use it. For example, go switch x.(type) { case int: fmt.Println(x.(int)) }
can be rewritten as go switch x := x.(type) { case int: fmt.Println(x) }
This would …
Occurrences
There are 2 occurrences of this issue in the repository.
See all occurrences on DeepSource → deepsource.io/gh/DrN3MESiS/pprnt/issue/SCC-S1034/occurrences/