all: simplify switches (#17267)

* all: simplify switches

* silly mistake
This commit is contained in:
Oleg Kovalov
2018-07-30 11:30:09 +02:00
committed by Péter Szilágyi
parent 273c7a9dc4
commit d42ce0f2c1
10 changed files with 20 additions and 34 deletions

View File

@ -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))
}