context/context.go: update stringify

Is it better to use switch type?
This commit is contained in:
喜欢兰花山丘 2019-04-16 11:41:45 +08:00 committed by GitHub
parent f248cd3a07
commit 9d654de10e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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>"