diff --git a/collectors/likwidMetric.go b/collectors/likwidMetric.go index 0056ffe..ae71389 100644 --- a/collectors/likwidMetric.go +++ b/collectors/likwidMetric.go @@ -187,7 +187,7 @@ func getBaseFreq() float64 { for _, f := range files { buffer, err := os.ReadFile(f) if err == nil { - data := strings.Replace(string(buffer), "\n", "", -1) + data := strings.ReplaceAll(string(buffer), "\n", "") x, err := strconv.ParseInt(data, 0, 64) if err == nil { freq = float64(x) diff --git a/collectors/nvidiaMetric.go b/collectors/nvidiaMetric.go index e6b03d5..e454330 100644 --- a/collectors/nvidiaMetric.go +++ b/collectors/nvidiaMetric.go @@ -1291,8 +1291,8 @@ func (m *NvidiaCollector) Read(interval time.Duration, output chan lp.CCMessage) if ret == nvml.SUCCESS { mname, ret := nvml.DeviceGetName(mdev) if ret == nvml.SUCCESS { - x := strings.Replace(mname, name, "", -1) - x = strings.Replace(x, "MIG", "", -1) + x := strings.ReplaceAll(mname, name, "") + x = strings.ReplaceAll(x, "MIG", "") x = strings.TrimSpace(x) migDevice.tags["stype-id"] = x } diff --git a/collectors/tempMetric.go b/collectors/tempMetric.go index d18dadb..2507246 100644 --- a/collectors/tempMetric.go +++ b/collectors/tempMetric.go @@ -117,7 +117,7 @@ func (m *TempCollector) Init(config json.RawMessage) error { sensor.metricName = sensor.label } sensor.metricName = strings.ToLower(sensor.metricName) - sensor.metricName = strings.Replace(sensor.metricName, " ", "_", -1) + sensor.metricName = strings.ReplaceAll(sensor.metricName, " ", "_") // Add temperature prefix, if required if !strings.Contains(sensor.metricName, "temp") { sensor.metricName = "temp_" + sensor.metricName diff --git a/internal/metricAggregator/metricAggregatorFunctions.go b/internal/metricAggregator/metricAggregatorFunctions.go index 997a168..1cc5a30 100644 --- a/internal/metricAggregator/metricAggregatorFunctions.go +++ b/internal/metricAggregator/metricAggregatorFunctions.go @@ -238,7 +238,7 @@ func matchfunc(args ...interface{}) (interface{}, error) { case string: switch total := args[1].(type) { case string: - smatch := strings.Replace(match, "%", "\\", -1) + smatch := strings.ReplaceAll(match, "%", "\\") regex, err := regexp.Compile(smatch) if err != nil { return false, err