From 9115d3f281c6934e5fb49bb9adc5d3cddfe44ad8 Mon Sep 17 00:00:00 2001 From: Ekaterina Lebedeva Date: Wed, 21 Aug 2024 16:43:53 +0300 Subject: [PATCH] [#1316] lint: Fix warnings Signed-off-by: Ekaterina Lebedeva --- .golangci.yml | 3 ++- netmap/aggregator.go | 12 ++++++------ netmap/context.go | 6 +++--- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index aca0746..ff8989a 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -12,7 +12,8 @@ run: # output configuration options output: # colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number" - format: tab + formats: + - format: tab # all available settings of specific linters linters-settings: diff --git a/netmap/aggregator.go b/netmap/aggregator.go index c4a43c1..1faba9e 100644 --- a/netmap/aggregator.go +++ b/netmap/aggregator.go @@ -73,8 +73,8 @@ func newMinAgg() aggregator { // newReverseMinNorm returns a normalizer which // normalize values in range of 0.0 to 1.0 to a minimum value. -func newReverseMinNorm(min float64) normalizer { - return &reverseMinNorm{min: min} +func newReverseMinNorm(minV float64) normalizer { + return &reverseMinNorm{min: minV} } // newSigmoidNorm returns a normalizer which @@ -125,22 +125,22 @@ func (a *meanIQRAgg) Compute() float64 { slices.Sort(a.arr) - var min, max float64 + var minV, maxV float64 const minLn = 4 if l < minLn { - min, max = a.arr[0], a.arr[l-1] + minV, maxV = a.arr[0], a.arr[l-1] } else { start, end := l/minLn, l*3/minLn-1 - min, max = a.arr[start], a.arr[end] + minV, maxV = a.arr[start], a.arr[end] } count := 0 sum := float64(0) for _, e := range a.arr { - if e >= min && e <= max { + if e >= minV && e <= maxV { sum += e count++ } diff --git a/netmap/context.go b/netmap/context.go index df3c85b..ca791e8 100644 --- a/netmap/context.go +++ b/netmap/context.go @@ -94,14 +94,14 @@ func (c *context) addUsedNodes(ns ...NodeInfo) { func defaultWeightFunc(ns nodes) weightFunc { mean := newMeanAgg() - min := newMinAgg() + minV := newMinAgg() for i := range ns { mean.Add(float64(ns[i].capacity())) - min.Add(float64(ns[i].Price())) + minV.Add(float64(ns[i].Price())) } return newWeightFunc( newSigmoidNorm(mean.Compute()), - newReverseMinNorm(min.Compute())) + newReverseMinNorm(minV.Compute())) }