mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-09-01 03:31:25 +02:00
Simplify redundant Atoi error check in deduplicateIISNames
Co-authored-by: jkroepke <1560587+jkroepke@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
6c83d1bbeb
commit
c6da1f64d9
@@ -322,10 +322,9 @@ func deduplicateIISNames[T collectorName](counterValues []T) []T {
|
||||
// Determine the numeric suffix for this entry (-1 means "no suffix").
|
||||
suffix := -1
|
||||
if baseName != name {
|
||||
// iisCounterBaseName guarantees the remainder after '#' is numeric.
|
||||
if n, err := strconv.Atoi(name[len(baseName)+1:]); err == nil {
|
||||
suffix = n
|
||||
}
|
||||
// iisCounterBaseName guarantees the remainder after '#' is numeric,
|
||||
// so the error can be safely ignored here.
|
||||
suffix, _ = strconv.Atoi(name[len(baseName)+1:])
|
||||
}
|
||||
|
||||
if e, ok := seen[baseName]; ok {
|
||||
|
||||
Reference in New Issue
Block a user