github.phpd.cn/thought-machine/please@v12.2.0+incompatible/third_party/go/gcfg_dynamic_fields.patch (about) 1 diff --git a/set.go b/set.go 2 index 6ca1051..43de5dc 100644 3 --- a/set.go 4 +++ b/set.go 5 @@ -201,6 +201,19 @@ func set(cfg interface{}, sect, sub, name string, blank bool, value string) erro 6 } 7 if vSect.Kind() == reflect.Map { 8 vst := vSect.Type() 9 + if vst.Key().Kind() == reflect.String && vst.Elem().Kind() == reflect.String { 10 + if vSect.IsNil() { 11 + vSect.Set(reflect.MakeMap(vst)) 12 + } 13 + if name != "" { 14 + if sub != "" { 15 + vSect.SetMapIndex(reflect.ValueOf(sub + " " + name), reflect.ValueOf(value)) 16 + } else { 17 + vSect.SetMapIndex(reflect.ValueOf(name), reflect.ValueOf(value)) 18 + } 19 + } 20 + return nil 21 + } 22 if vst.Key().Kind() != reflect.String || 23 vst.Elem().Kind() != reflect.Ptr || 24 vst.Elem().Elem().Kind() != reflect.Struct {