summaryrefslogtreecommitdiffstats
path: root/metrics/metrics.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-03-17 22:03:27 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-03-17 22:03:27 +0100
commitb80853de90b10171155b8f3fde47d64ec7bfa0dd (patch)
tree435d3dbf7a495a0c6ce64c9769e037179aa0d27b /metrics/metrics.go
parent423594e03a906ef4150f433666ff588b022c3c92 (diff)
all: gofmt -w -r 'interface{} -> any' .
Updates #9687
Diffstat (limited to 'metrics/metrics.go')
-rw-r--r--metrics/metrics.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/metrics/metrics.go b/metrics/metrics.go
index 12f825e19..9c46fdf7e 100644
--- a/metrics/metrics.go
+++ b/metrics/metrics.go
@@ -40,19 +40,19 @@ type Provider interface {
WriteMetrics(w io.Writer)
// TrackValue tracks the value for diff calculations etc.
- TrackValue(key string, value interface{}, cached bool)
+ TrackValue(key string, value any, cached bool)
// Reset clears the metric store.
Reset()
}
type diff struct {
- baseline interface{}
+ baseline any
count int
simSum int
}
-func (d *diff) add(v interface{}) *diff {
+func (d *diff) add(v any) *diff {
if types.IsNil(d.baseline) {
d.baseline = v
d.count = 1
@@ -103,7 +103,7 @@ func (s *Store) Reset() {
}
// TrackValue tracks the value for diff calculations etc.
-func (s *Store) TrackValue(key string, value interface{}, cached bool) {
+func (s *Store) TrackValue(key string, value any, cached bool) {
if !s.calculateHints {
return
}
@@ -207,7 +207,7 @@ func (b bySum) Less(i, j int) bool { return b[i].sum > b[j].sum }
// howSimilar is a naive diff implementation that returns
// a number between 0-100 indicating how similar a and b are.
-func howSimilar(a, b interface{}) int {
+func howSimilar(a, b any) int {
t1, t2 := reflect.TypeOf(a), reflect.TypeOf(b)
if t1 != t2 {
return 0