12 x := "foo" + strings.Repeat("\t", n)
13 // Match, despite named import.
16 // Match, despite dot import.
19 // Match: multiple matches in same function are possible.
22 // No match: wildcarded operand has the wrong type.
25 // No match: function operand doesn't match.
28 // No match again, dot import.
32 myfmt.Fprint(os.Stderr, errors.New(x+"foo"))
34 // No match: though this literally matches the template,
35 // fmt doesn't resolve to a package here.
36 var fmt struct{ Errorf func(string, string) }
39 // Recursive matching:
41 // Match: both matches are well-typed, so both succeed.
42 errors.New(errors.New(x + "foo").Error())
44 // Outer match succeeds, inner doesn't: 3 has wrong type.
45 errors.New(myfmt.Errorf("%s", 3).Error())
47 // Inner match succeeds, outer doesn't: the inner replacement
48 // has the wrong type (error not string).
49 myfmt.Errorf("%s", errors.New(x+"foo"))