mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-10-09 22:29:06 +02:00
chore(deps): update dependency golangci/golangci-lint to v2.13.1 (master) (#2477)
Co-authored-by: Jan-Otto Kröpke <mail@jkroepke.de> Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
co-authored by
Jan-Otto Kröpke
parent
2743d4e3f7
commit
75b0c11bb4
@@ -94,5 +94,5 @@ jobs:
|
|||||||
uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0
|
uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0
|
||||||
with:
|
with:
|
||||||
# renovate: github=golangci/golangci-lint
|
# renovate: github=golangci/golangci-lint
|
||||||
version: v2.12.2
|
version: v2.13.1
|
||||||
args: "--max-same-issues=0"
|
args: "--max-same-issues=0"
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
# $schema: https://golangci-lint.run/jsonschema/golangci.jsonschema.json
|
||||||
version: "2"
|
version: "2"
|
||||||
linters:
|
linters:
|
||||||
default: all
|
default: all
|
||||||
@@ -9,6 +10,7 @@ linters:
|
|||||||
- err113
|
- err113
|
||||||
- exhaustive
|
- exhaustive
|
||||||
- exhaustruct
|
- exhaustruct
|
||||||
|
- exhaustruct_v5
|
||||||
- fatcontext
|
- fatcontext
|
||||||
- funcorder
|
- funcorder
|
||||||
- funlen
|
- funlen
|
||||||
|
|||||||
@@ -190,8 +190,7 @@ func waitUntilListening(tb testing.TB, network, address string) error {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
var winErr windows.Errno
|
if winErr, ok := errors.AsType[windows.Errno](err); ok {
|
||||||
if errors.As(err, &winErr) {
|
|
||||||
return fmt.Errorf("listener not listening: %w (#%d)", winErr, uint32(winErr))
|
return fmt.Errorf("listener not listening: %w (#%d)", winErr, uint32(winErr))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -304,7 +304,7 @@ func deduplicateIISNames[T collectorName](counterValues []T) {
|
|||||||
|
|
||||||
// Use map to deduplicate IIS entries
|
// Use map to deduplicate IIS entries
|
||||||
for index, counterValue := range counterValues {
|
for index, counterValue := range counterValues {
|
||||||
name := strings.Split(counterValue.GetName(), "#")[0]
|
name, _, _ := strings.Cut(counterValue.GetName(), "#")
|
||||||
if name == counterValue.GetName() {
|
if name == counterValue.GetName() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -328,7 +328,7 @@ func (c *Collector) collectObject(ch chan<- prometheus.Metric, perfDataObject Ob
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
metricType, _ := field.Interface().(prometheus.ValueType)
|
metricType, _ := reflect.TypeAssert[prometheus.ValueType](field)
|
||||||
|
|
||||||
labels := make(prometheus.Labels, len(counter.Labels)+1)
|
labels := make(prometheus.Labels, len(counter.Labels)+1)
|
||||||
|
|
||||||
|
|||||||
@@ -265,7 +265,7 @@ func (c *Collector) groupPrintJobs(printJobs []wmiPrintJob) map[PrintJobStatusGr
|
|||||||
groupedPrintJobs := make(map[PrintJobStatusGroup]int)
|
groupedPrintJobs := make(map[PrintJobStatusGroup]int)
|
||||||
|
|
||||||
for _, printJob := range printJobs {
|
for _, printJob := range printJobs {
|
||||||
printerName := strings.Split(printJob.Name, ",")[0]
|
printerName, _, _ := strings.Cut(printJob.Name, ",")
|
||||||
|
|
||||||
if c.config.PrinterExclude.MatchString(printerName) ||
|
if c.config.PrinterExclude.MatchString(printerName) ||
|
||||||
!c.config.PrinterInclude.MatchString(printerName) {
|
!c.config.PrinterInclude.MatchString(printerName) {
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ func GetDHCPV4ScopeStatistics() ([]DHCPV4Scope, error) {
|
|||||||
var errs []error
|
var errs []error
|
||||||
|
|
||||||
for _, subnet := range subnets {
|
for _, subnet := range subnets {
|
||||||
if err := (func() error {
|
if err := func() error {
|
||||||
var subnetInfo *DHCP_SUBNET_INFO
|
var subnetInfo *DHCP_SUBNET_INFO
|
||||||
|
|
||||||
err := dhcpGetSubnetInfo(subnet.SubnetAddress, &subnetInfo)
|
err := dhcpGetSubnetInfo(subnet.SubnetAddress, &subnetInfo)
|
||||||
@@ -129,7 +129,7 @@ func GetDHCPV4ScopeStatistics() ([]DHCPV4Scope, error) {
|
|||||||
scopes = append(scopes, scope)
|
scopes = append(scopes, scope)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
})(); err != nil {
|
}(); err != nil {
|
||||||
errs = append(errs, err)
|
errs = append(errs, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ var (
|
|||||||
func GetPerformanceInfo() (PerformanceInformation, error) {
|
func GetPerformanceInfo() (PerformanceInformation, error) {
|
||||||
var lppi PerformanceInformation
|
var lppi PerformanceInformation
|
||||||
|
|
||||||
size := (uint32)(unsafe.Sizeof(lppi))
|
size := uint32(unsafe.Sizeof(lppi))
|
||||||
lppi.cb = size
|
lppi.cb = size
|
||||||
r1, _, err := procGetPerformanceInfo.Call(uintptr(unsafe.Pointer(&lppi)), uintptr(size))
|
r1, _, err := procGetPerformanceInfo.Call(uintptr(unsafe.Pointer(&lppi)), uintptr(size))
|
||||||
|
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ var (
|
|||||||
func GlobalMemoryStatusEx() (MemoryStatus, error) {
|
func GlobalMemoryStatusEx() (MemoryStatus, error) {
|
||||||
var mse memoryStatusEx
|
var mse memoryStatusEx
|
||||||
|
|
||||||
mse.dwLength = (uint32)(unsafe.Sizeof(mse))
|
mse.dwLength = uint32(unsafe.Sizeof(mse))
|
||||||
r1, _, err := procGlobalMemoryStatusEx.Call(uintptr(unsafe.Pointer(&mse)))
|
r1, _, err := procGlobalMemoryStatusEx.Call(uintptr(unsafe.Pointer(&mse)))
|
||||||
|
|
||||||
if ret := *(*bool)(unsafe.Pointer(&r1)); !ret {
|
if ret := *(*bool)(unsafe.Pointer(&r1)); !ret {
|
||||||
|
|||||||
@@ -35,8 +35,7 @@ func (m *Error) Is(err error) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
var e *Error
|
if e, ok := errors.AsType[*Error](err); ok {
|
||||||
if errors.As(err, &e) {
|
|
||||||
return m.ErrorCode == e.ErrorCode
|
return m.ErrorCode == e.ErrorCode
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -254,8 +254,7 @@ func queryRawData(query string) ([]byte, error) {
|
|||||||
|
|
||||||
continue
|
continue
|
||||||
case err != nil:
|
case err != nil:
|
||||||
var errNo windows.Errno
|
if errNo, ok := errors.AsType[windows.Errno](err); ok {
|
||||||
if errors.As(err, &errNo) {
|
|
||||||
return nil, fmt.Errorf("ReqQueryValueEx failed: %w errno %d", err, uint(errNo))
|
return nil, fmt.Errorf("ReqQueryValueEx failed: %w errno %d", err, uint(errNo))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user