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:
parent
b10e067fe9
commit
faa3adc300
@ -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()))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user