all: Use new reflect based CLI (#5487)

This commit is contained in:
Audrius Butkevicius
2019-02-12 06:58:24 +00:00
committed by Jakob Borg
parent 7bac927ac8
commit dc929946fe
37 changed files with 944 additions and 1723 deletions

View File

@@ -12,8 +12,9 @@ type Defaulter struct {
Value string
}
func (Defaulter) ParseDefault(v string) (interface{}, error) {
return Defaulter{Value: v}, nil
func (d *Defaulter) ParseDefault(v string) error {
*d = Defaulter{Value: v}
return nil
}
func TestSetDefaults(t *testing.T) {
@@ -37,9 +38,7 @@ func TestSetDefaults(t *testing.T) {
t.Errorf("defaulter failed")
}
if err := SetDefaults(x); err != nil {
t.Error(err)
}
SetDefaults(x)
if x.A != "string" {
t.Error("string failed")