mirror of
https://github.com/golang/go
synced 2024-11-17 13:44:43 -07:00
context/context.go: update stringify
Is it better to use switch type?
This commit is contained in:
parent
f248cd3a07
commit
9d654de10e
@ -497,10 +497,10 @@ type valueCtx struct {
|
||||
// want context depending on the unicode tables. This is only used by
|
||||
// *valueCtx.String().
|
||||
func stringify(v interface{}) string {
|
||||
if s, ok := v.(stringer); ok {
|
||||
switch s := v.(type) {
|
||||
case stringer:
|
||||
return s.String()
|
||||
}
|
||||
if s, ok := v.(string); ok {
|
||||
case string:
|
||||
return s
|
||||
}
|
||||
return "<not Stringer>"
|
||||
|
Loading…
Reference in New Issue
Block a user