Go

Go

Made by DeepSource

Found redundant nil check in type assertion SCC-S1020

Anti-pattern
Major
Autofix

There is no need to check for nil when performing type assertion as it is implicitly handled. When false, the second value returned confirms that the value of the asserted type is nil.

Bad practice

if _, ok := i.(T); ok && i != nil {}

Recommended

if _, ok := i.(T); ok {}