From d42ce0f2c1b52e26cce475e411d97165fb975577 Mon Sep 17 00:00:00 2001 From: Oleg Kovalov Date: Mon, 30 Jul 2018 11:30:09 +0200 Subject: all: simplify switches (#17267) * all: simplify switches * silly mistake --- metrics/exp/exp.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'metrics') diff --git a/metrics/exp/exp.go b/metrics/exp/exp.go index 625ffd4e8..325a193c7 100644 --- a/metrics/exp/exp.go +++ b/metrics/exp/exp.go @@ -147,21 +147,21 @@ func (exp *exp) publishResettingTimer(name string, metric metrics.ResettingTimer func (exp *exp) syncToExpvar() { exp.registry.Each(func(name string, i interface{}) { - switch i.(type) { + switch i := i.(type) { case metrics.Counter: - exp.publishCounter(name, i.(metrics.Counter)) + exp.publishCounter(name, i) case metrics.Gauge: - exp.publishGauge(name, i.(metrics.Gauge)) + exp.publishGauge(name, i) case metrics.GaugeFloat64: - exp.publishGaugeFloat64(name, i.(metrics.GaugeFloat64)) + exp.publishGaugeFloat64(name, i) case metrics.Histogram: - exp.publishHistogram(name, i.(metrics.Histogram)) + exp.publishHistogram(name, i) case metrics.Meter: - exp.publishMeter(name, i.(metrics.Meter)) + exp.publishMeter(name, i) case metrics.Timer: - exp.publishTimer(name, i.(metrics.Timer)) + exp.publishTimer(name, i) case metrics.ResettingTimer: - exp.publishResettingTimer(name, i.(metrics.ResettingTimer)) + exp.publishResettingTimer(name, i) default: panic(fmt.Sprintf("unsupported type for '%s': %T", name, i)) } -- cgit