github.com/switchupcb/yaegi@v0.10.2/_test/issue-1126.go (about) 1 package main 2 3 import ( 4 "errors" 5 "fmt" 6 "strings" 7 ) 8 9 func main() { 10 err := errors.New("hello there") 11 12 switch true { 13 case err == nil: 14 break 15 case strings.Contains(err.Error(), "hello"): 16 fmt.Println("True!") 17 default: 18 fmt.Println("False!") 19 } 20 } 21 22 // Output: 23 // True!