chore(deps): update dependency golangci/golangci-lint to v2.6.0 (#2246)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
renovate[bot]
2025-11-02 19:41:27 +01:00
committed by GitHub
parent a523ef69fd
commit 3d0587d28c
14 changed files with 31 additions and 42 deletions

View File

@@ -110,7 +110,7 @@ func NewCollectorWithReflection(logger *slog.Logger, resultType CounterType, obj
}
if f, ok := valueType.FieldByName("MetricType"); ok {
if f.Type.Kind() == reflect.TypeOf(prometheus.ValueType(0)).Kind() {
if f.Type.Kind() == reflect.TypeFor[prometheus.ValueType]().Kind() {
collector.metricsTypeIndexValue = f.Index[0]
}
}

View File

@@ -53,9 +53,7 @@ func NewCollector[T any](object string, _ []string) (*Collector, error) {
counters: make(map[string]Counter),
}
var values [0]T
valueType := reflect.TypeOf(values).Elem()
valueType := reflect.TypeFor[T]().Elem()
if f, ok := valueType.FieldByName("Name"); ok {
if f.Type.Kind() == reflect.String {
@@ -81,9 +79,7 @@ func NewCollector[T any](object string, _ []string) (*Collector, error) {
}
}
if strings.HasSuffix(counterName, ",secondvalue") {
counterName = strings.TrimSuffix(counterName, ",secondvalue")
if counterName, ok = strings.CutSuffix(counterName, ",secondvalue"); ok {
counter.FieldIndexSecondValue = f.Index[0]
} else {
counter.FieldIndexValue = f.Index[0]