13 x := "foo" + strings.Repeat("\t", n)
14 // Match, despite named import.
17 // Match, despite dot import.
20 // Match: multiple matches in same function are possible.
23 // No match: wildcarded operand has the wrong type.
26 // No match: function operand doesn't match.
29 // No match again, dot import.
33 myfmt.Fprint(os.Stderr, myfmt.Errorf("%s", x+"foo"))
35 // No match: though this literally matches the template,
36 // fmt doesn't resolve to a package here.
37 var fmt struct{ Errorf func(string, string) }
40 // Recursive matching:
42 // Match: both matches are well-typed, so both succeed.
43 myfmt.Errorf("%s", myfmt.Errorf("%s", x+"foo").Error())
45 // Outer match succeeds, inner doesn't: 3 has wrong type.
46 myfmt.Errorf("%s", myfmt.Errorf("%s", 3).Error())
48 // Inner match succeeds, outer doesn't: the inner replacement
49 // has the wrong type (error not string).
50 myfmt.Errorf("%s", myfmt.Errorf("%s", x+"foo"))