1
0
mirror of https://github.com/mgechev/revive.git synced 2024-11-24 08:32:22 +02:00
revive/testdata/unchecked-type-assertion-accept-ignored.go
Dirk Faust 95acb880a1
Add unchecked-type-assertion (#889)
Co-authored-by: Dirk Faust <d.faust@mittwald.de>
2023-09-17 10:58:45 +02:00

13 lines
316 B
Go

package fixtures
var foo any = "foo"
func handleIgnoredIsOKByConfig() {
// No lint here bacuse `acceptIgnoredAssertionResult` is set to `true`
r, _ := foo.(int)
}
func handleSkippedStillFails() {
r := foo.(int) // MATCH /type cast result is unchecked in foo.(int) - type assertion will panic if not matched/
}