From b5c984b839f5f8f933fced4d9d7e29ec50a222ea Mon Sep 17 00:00:00 2001 From: Yoshi Yamaguchi <145104+ymotongpoo@users.noreply.github.com> Date: Fri, 4 Oct 2019 16:17:11 +0900 Subject: [PATCH] Fix unnecessary type assertion in switch clause (#167) --- experimental/bridge/opentracing/bridge.go | 24 +++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/experimental/bridge/opentracing/bridge.go b/experimental/bridge/opentracing/bridge.go index 4fa4a8fe2..6ff0f6db7 100644 --- a/experimental/bridge/opentracing/bridge.go +++ b/experimental/bridge/opentracing/bridge.go @@ -403,29 +403,29 @@ func otTagsToOtelAttributesKindAndError(tags map[string]interface{}) ([]otelcore func otTagToOtelCoreKeyValue(k string, v interface{}) otelcore.KeyValue { key := otTagToOtelCoreKey(k) - switch v.(type) { + switch val := v.(type) { case bool: - return key.Bool(v.(bool)) + return key.Bool(val) case int64: - return key.Int64(v.(int64)) + return key.Int64(val) case uint64: - return key.Uint64(v.(uint64)) + return key.Uint64(val) case float64: - return key.Float64(v.(float64)) + return key.Float64(val) case int32: - return key.Int32(v.(int32)) + return key.Int32(val) case uint32: - return key.Uint32(v.(uint32)) + return key.Uint32(val) case float32: - return key.Float32(v.(float32)) + return key.Float32(val) case int: - return key.Int(v.(int)) + return key.Int(val) case uint: - return key.Uint(v.(uint)) + return key.Uint(val) case string: - return key.String(v.(string)) + return key.String(val) case []byte: - return key.Bytes(v.([]byte)) + return key.Bytes(val) default: return key.String(fmt.Sprint(v)) }