1
2
3
4
5
6
7 package main
8
9 import "errors"
10
11
12
13
14
15 func main() {
16 var listen, _ = Listen("tcp", "127.0.0.1:0")
17
18 go func() {
19 for {
20 var conn, _ = listen.Accept()
21 _ = conn
22 }
23 }()
24
25 var conn, _ = Dial("tcp", "", listen.Addr().Error())
26 _ = conn
27 }
28
29
30
31 type T chan int
32
33 var global T
34
35 func Listen(x, y string) (T, string) {
36 global = make(chan int)
37 return global, y
38 }
39
40 func (t T) Addr() error {
41 return errors.New("stringer")
42 }
43
44 func (t T) Accept() (int, string) {
45 return <-t, ""
46 }
47
48 func Dial(x, y, z string) (int, string) {
49 global <- 1
50 return 0, ""
51 }
52
View as plain text