fix the static ckeck linter issues

This commit is contained in:
Sergey Kanzhelev
2025-09-08 19:10:28 +00:00
parent 2995ae12e0
commit a3a4504706
14 changed files with 52 additions and 47 deletions
+1 -1
View File
@@ -73,7 +73,7 @@ func getOSVersion(osReleasePath string) (string, error) {
case "flatcar":
return getDebianVersion(osReleaseMap), nil
default:
return "", fmt.Errorf("Unsupported ID in /etc/os-release: %q", osReleaseMap["ID"])
return "", fmt.Errorf("unsupported ID in /etc/os-release: %q", osReleaseMap["ID"])
}
}
+4 -3
View File
@@ -87,11 +87,12 @@ func ParsePrometheusMetrics(metricsText string) ([]Float64MetricRepresentation,
}
var value float64
if *metricFamily.Type == pcm.MetricType_COUNTER {
switch *metricFamily.Type {
case pcm.MetricType_COUNTER:
value = *metric.Counter.Value
} else if *metricFamily.Type == pcm.MetricType_GAUGE {
case pcm.MetricType_GAUGE:
value = *metric.Gauge.Value
} else {
default:
return metrics, fmt.Errorf("unexpected MetricType %s for metric %s",
pcm.MetricType_name[int32(*metricFamily.Type)], *metricFamily.Name)
}