1
0
mirror of https://github.com/go-kratos/kratos.git synced 2025-03-17 21:07:54 +02:00

style(config/value): optimize atomicValue format string (#2401)

This commit is contained in:
Gaffey 2022-09-27 23:12:18 +08:00 committed by GitHub
parent b10e067fe9
commit faa3adc300
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -144,10 +144,8 @@ func (v *atomicValue) String() (string, error) {
return fmt.Sprint(val), nil
case []byte:
return string(val), nil
default:
if s, ok := val.(fmt.Stringer); ok {
return s.String(), nil
}
case fmt.Stringer:
return val.String(), nil
}
return "", fmt.Errorf("type assert to %v failed", reflect.TypeOf(v.Load()))
}