summaryrefslogtreecommitdiffstats
path: root/metrics
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-12-02 13:23:25 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-12-03 13:12:58 +0100
commitd90e37e0c6e812f9913bf256c9c81aa05b7a08aa (patch)
tree7b1b14464eefec1188ca2eed53c64e4823453cc9 /metrics
parent32471b57bde51c55a15dbf1db75d6e5f7232c347 (diff)
all: Format code with gofumpt
See https://github.com/mvdan/gofumpt
Diffstat (limited to 'metrics')
-rw-r--r--metrics/metrics.go13
-rw-r--r--metrics/metrics_test.go2
2 files changed, 5 insertions, 10 deletions
diff --git a/metrics/metrics.go b/metrics/metrics.go
index 30a69be4b..f48ee33e0 100644
--- a/metrics/metrics.go
+++ b/metrics/metrics.go
@@ -15,21 +15,20 @@
package metrics
import (
- "reflect"
-
- "github.com/gohugoio/hugo/helpers"
-
- "github.com/gohugoio/hugo/common/types"
-
"fmt"
"io"
"math"
+ "reflect"
"sort"
"strconv"
"strings"
"sync"
"time"
+ "github.com/gohugoio/hugo/helpers"
+
+ "github.com/gohugoio/hugo/common/types"
+
"github.com/gohugoio/hugo/compare"
)
@@ -182,7 +181,6 @@ func (s *Store) WriteMetrics(w io.Writer) {
fmt.Fprintf(w, " %13s %12s %12s %5d %s\n", v.sum, v.avg, v.max, v.count, v.key)
}
}
-
}
// A result represents the calculated results for a given metric.
@@ -243,7 +241,6 @@ func howSimilar(a, b interface{}) int {
return 100
}
return 0
-
}
// howSimilar is a naive diff implementation that returns
diff --git a/metrics/metrics_test.go b/metrics/metrics_test.go
index 057d58662..d28efa25e 100644
--- a/metrics/metrics_test.go
+++ b/metrics/metrics_test.go
@@ -43,7 +43,6 @@ func TestSimilarPercentage(t *testing.T) {
c.Assert(howSimilar(template.HTML("Hugo Rules"), template.HTML("Hugo Rules")), qt.Equals, 100)
c.Assert(howSimilar(map[string]interface{}{"a": 32, "b": 33}, map[string]interface{}{"a": 32, "b": 33}), qt.Equals, 100)
c.Assert(howSimilar(map[string]interface{}{"a": 32, "b": 33}, map[string]interface{}{"a": 32, "b": 34}), qt.Equals, 0)
-
}
type testStruct struct {
@@ -56,7 +55,6 @@ func TestSimilarPercentageNonString(t *testing.T) {
c.Assert(howSimilar(page.Pages{}, page.Pages{}), qt.Equals, 90)
c.Assert(howSimilar(testStruct{Name: "A"}, testStruct{Name: "B"}), qt.Equals, 0)
c.Assert(howSimilar(testStruct{Name: "A"}, testStruct{Name: "A"}), qt.Equals, 100)
-
}
func BenchmarkHowSimilar(b *testing.B) {