Source file
test/fixedbugs/issue27695.go
1
2
3
4
5
6
7
8
9
10 package main
11
12 import (
13 "reflect"
14 "runtime/debug"
15 "sync"
16 )
17
18 func main() {
19 debug.SetGCPercent(1)
20 var wg sync.WaitGroup
21 for i := 0; i < 20; i++ {
22 wg.Add(1)
23 go func() {
24 defer wg.Done()
25 for i := 0; i < 2000; i++ {
26 _test()
27 }
28 }()
29 }
30 wg.Wait()
31 }
32
33 type Stt struct {
34 Data interface{}
35 }
36
37 type My struct {
38 b byte
39 }
40
41 func (this *My) Run(rawData []byte) (Stt, error) {
42 var data string = "hello"
43 stt := Stt{
44 Data: data,
45 }
46 return stt, nil
47 }
48
49 func _test() (interface{}, error) {
50 f := reflect.ValueOf(&My{}).MethodByName("Run")
51 if method, ok := f.Interface().(func([]byte) (Stt, error)); ok {
52 s, e := method(nil)
53
54
55
56
57
58 i := interface{}(s)
59 return i, e
60 }
61 return nil, nil
62 }
63
View as plain text