Use comma-ok type assertion

Proprietary

Transform bare type assertions v := x.(T) into v, ok := x.(T) with _ = ok to avoid panics on assertion failure.

org.openrewrite.golang.codequality.UseCommaOkTypeAssertion
mod run . --recipe=org.openrewrite.golang.codequality.UseCommaOkTypeAssertion

Install it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.