1 | package main |
---|---|
2 | |
3 | // Regression test for https://golang.org/issue/23925 |
4 | |
5 | type stringFlagImpl string |
6 | |
7 | func (*stringFlagImpl) Set(s string) error { return nil } |
8 | |
9 | type boolFlagImpl bool |
10 | |
11 | func (*boolFlagImpl) Set(s string) error { return nil } |
12 | func (*boolFlagImpl) extra() {} |
13 | |
14 | // A copy of flag.boolFlag interface, without a dependency. |
15 | // Must appear first, so that it becomes the owner of the Set methods. |
16 | type boolFlag interface { |
17 | flagValue |
18 | extra() |
19 | } |
20 | |
21 | // A copy of flag.Value, without adding a dependency. |
22 | type flagValue interface { |
23 | Set(string) error |
24 | } |
25 | |
26 | func main() { |
27 | var x flagValue = new(stringFlagImpl) |
28 | x.Set("") |
29 | |
30 | var y boolFlag = new(boolFlagImpl) |
31 | y.Set("") |
32 | } |
33 | |
34 | // WANT: |
35 | // Dynamic calls |
36 | // main --> (*boolFlagImpl).Set |
37 | // main --> (*boolFlagImpl).Set |
38 | // main --> (*stringFlagImpl).Set |
39 |
Members