Golangci modernize fixes (#196)

* Fix: Loop can be simplified using slices.Contains
* Fix: for loop can be modernized using range over int
* Fix: interface{} can be replaced by any
* Fix: Replace m[k]=v loop with maps.Copy
* Run all linters with golangci-lint
This commit is contained in:
Holger Obermaier
2026-02-10 13:33:04 +01:00
committed by GitHub
parent cca0d23efa
commit fc297854d2
31 changed files with 199 additions and 240 deletions

View File

@@ -10,6 +10,7 @@ package metricRouter
import (
"encoding/json"
"fmt"
"maps"
"os"
"strings"
"sync"
@@ -192,8 +193,8 @@ func (r *metricRouter) Init(ticker mct.MultiChanTicker, wg *sync.WaitGroup, rout
return nil
}
func getParamMap(point lp.CCMessage) map[string]interface{} {
params := make(map[string]interface{})
func getParamMap(point lp.CCMessage) map[string]any {
params := make(map[string]any)
params["metric"] = point
params["name"] = point.Name()
for key, value := range point.Tags() {
@@ -202,9 +203,7 @@ func getParamMap(point lp.CCMessage) map[string]interface{} {
for key, value := range point.Meta() {
params[key] = value
}
for key, value := range point.Fields() {
params[key] = value
}
maps.Copy(params, point.Fields())
params["timestamp"] = point.Time()
return params
}