Fix QF1004: could use strings.ReplaceAll instead (staticcheck)

This commit is contained in:
Holger Obermaier
2026-02-04 10:37:22 +01:00
parent 3c03f4ac96
commit c24b3a7e4b
4 changed files with 5 additions and 5 deletions

View File

@@ -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