| 1 |
package main |
| 2 |
|
| 3 |
|
| 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 |
|
| 15 |
|
| 16 |
type boolFlag interface { |
| 17 |
flagValue |
| 18 |
extra() |
| 19 |
} |
| 20 |
|
| 21 |
|
| 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 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|