diff options
author | Oleg Kovalov <iamolegkovalov@gmail.com> | 2018-07-30 17:30:09 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2018-07-30 17:30:09 +0800 |
commit | d42ce0f2c1b52e26cce475e411d97165fb975577 (patch) | |
tree | 03043c37becf49145b23f4824f563e3443335698 /metrics/exp | |
parent | 273c7a9dc4e8961e96e51bd8274436ff983a21ef (diff) | |
download | dexon-d42ce0f2c1b52e26cce475e411d97165fb975577.tar.gz dexon-d42ce0f2c1b52e26cce475e411d97165fb975577.tar.zst dexon-d42ce0f2c1b52e26cce475e411d97165fb975577.zip |
all: simplify switches (#17267)
* all: simplify switches
* silly mistake
Diffstat (limited to 'metrics/exp')
-rw-r--r-- | metrics/exp/exp.go | 16 |
1 files changed, 8 insertions, 8 deletions
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)) } |