lib/weakhash, lib/model, cmd/syncthing: Decide if to use weakhash on startup (fixes #3938)
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3949
This commit is contained in:
@@ -25,6 +25,17 @@ func SetDefaults(data interface{}) error {
|
||||
|
||||
v := tag.Get("default")
|
||||
if len(v) > 0 {
|
||||
if parser, ok := f.Interface().(interface {
|
||||
ParseDefault(string) (interface{}, error)
|
||||
}); ok {
|
||||
val, err := parser.ParseDefault(v)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
f.Set(reflect.ValueOf(val))
|
||||
continue
|
||||
}
|
||||
|
||||
switch f.Interface().(type) {
|
||||
case string:
|
||||
f.SetString(v)
|
||||
|
||||
Reference in New Issue
Block a user