...
1
2
3
4
5 package main
6
7
8
9 import "C"
10
11
12
13
14 import (
15 "reflect"
16 "strings"
17
18 "testplugin/common"
19 )
20
21 func init() {
22 _ = strings.NewReplacer()
23 C.strerror(C.EIO)
24 common.X = 2
25 }
26
27 type sameNameReusedInPlugins struct {
28 X string
29 }
30
31 type sameNameHolder struct {
32 F *sameNameReusedInPlugins
33 }
34
35 func UnexportedNameReuse() {
36 h := sameNameHolder{}
37 v := reflect.ValueOf(&h).Elem().Field(0)
38 newval := reflect.New(v.Type().Elem())
39 v.Set(newval)
40 }
41
42 func main() {
43 panic("plugin1.main called")
44 }
45
View as plain text