'go-staticcheck s1040:Type assertion of current type [duplicate]

Sry if this is a dump questions. I was reading the error message of the go linter. It says that

The type assertion 'x.(SomeInterface)', when 'x' already has type 'SomeInterface', can only fail if 'x' is nil. Usually, this is left-over code from when 'x' had a different type and you can safely delete the type assertion. If you want to check that 'x' is not nil, consider being explicit and using an actual 'if x == nil' comparison instead of relying on the type assertion panicking.

Actually I am new to go.

Can anyone give an example for helping me understand this



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source