14 x := "foo" + strings.Repeat("\t", n)
15 // Match, despite named import.
18 // Match, despite dot import.
21 // Match: multiple matches in same function are possible.
24 // No match: wildcarded operand has the wrong type.
27 // No match: function operand doesn't match.
30 // No match again, dot import.
34 myfmt.Fprint(os.Stderr, errors.New(x+"foo"))
36 // No match: though this literally matches the template,
37 // fmt doesn't resolve to a package here.
38 var fmt struct{ Errorf func(string, string) }
41 // Recursive matching:
43 // Match: both matches are well-typed, so both succeed.
44 errors.New(errors.New(x + "foo").Error())
46 // Outer match succeeds, inner doesn't: 3 has wrong type.
47 errors.New(myfmt.Errorf("%s", 3).Error())
49 // Inner match succeeds, outer doesn't: the inner replacement
50 // has the wrong type (error not string).
51 myfmt.Errorf("%s", errors.New(x+"foo"))