Run go mod tidy and adapt to prometheus/common v0.67 API

This commit is contained in:
Ciprian Hacman
2026-05-04 12:04:39 +03:00
parent 5833635a1a
commit f844870ae3
329 changed files with 32559 additions and 35939 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
env:
CIRRUS_CLONE_DEPTH: 1
GO_VERSION: go1.24.0
GO_VERSION: go1.25.0
freebsd_13_task:
freebsd_instance:
+8 -12
View File
@@ -25,10 +25,13 @@ const (
_POSIX2_UPE = -1
)
var clktck struct {
sync.Once
v int64
}
var clktck = sync.OnceValue(func() int64 {
ci, err := unix.SysctlClockinfo("kern.clockrate")
if err != nil {
return -1
}
return int64(ci.Hz)
})
func sysconfPOSIX(name int) (int64, error) {
// NetBSD does not define all _POSIX_* values used in sysconf_posix.go
@@ -54,14 +57,7 @@ func sysconf(name int) (int64, error) {
}
return -1, nil
case SC_CLK_TCK:
// TODO: use sync.OnceValue once Go 1.21 is the minimal supported version
clktck.Do(func() {
clktck.v = -1
if ci, err := unix.SysctlClockinfo("kern.clockrate"); err == nil {
clktck.v = int64(ci.Hz)
}
})
return clktck.v, nil
return clktck(), nil
case SC_NGROUPS_MAX:
return sysctl32("kern.ngroups"), nil
case SC_JOB_CONTROL:
+1 -1
View File
@@ -1,6 +1,6 @@
env:
CIRRUS_CLONE_DEPTH: 1
GO_VERSION: go1.24.0
GO_VERSION: go1.25.0
freebsd_13_task:
freebsd_instance:
+7 -3
View File
@@ -47,10 +47,12 @@ func readCPURangeWith[T any](file string, f func(cpus string) (T, error)) (T, er
if err != nil {
return zero, err
}
return f(strings.Trim(string(buf), "\n "))
return f(string(buf))
}
func countCPURange(cpus string) (int, error) {
cpus = strings.Trim(cpus, "\n ")
// Treat empty file as valid. This might be the case if there are no offline CPUs in which
// case /sys/devices/system/cpu/offline is empty.
if cpus == "" {
@@ -58,7 +60,7 @@ func countCPURange(cpus string) (int, error) {
}
n := int(0)
for _, cpuRange := range strings.Split(cpus, ",") {
for cpuRange := range strings.SplitSeq(cpus, ",") {
if cpuRange == "" {
return 0, fmt.Errorf("empty CPU range in CPU string %q", cpus)
}
@@ -84,13 +86,15 @@ func countCPURange(cpus string) (int, error) {
}
func listCPURange(cpus string) ([]int, error) {
cpus = strings.Trim(cpus, "\n ")
// See comment in countCPURange.
if cpus == "" {
return []int{}, nil
}
list := []int{}
for _, cpuRange := range strings.Split(cpus, ",") {
for cpuRange := range strings.SplitSeq(cpus, ",") {
if cpuRange == "" {
return nil, fmt.Errorf("empty CPU range in CPU string %q", cpus)
}