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