From 5827ecb42e6f150adb802e75a6fc30a0bd4fa16e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 2 Jan 2024 12:36:51 +0000 Subject: [PATCH] fix(deps): update module github.com/shirou/gopsutil/v3 to v3.23.12 Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- .../shirou/gopsutil/v3/cpu/cpu_aix_nocgo.go | 11 ++++------- .../github.com/shirou/gopsutil/v3/cpu/cpu_solaris.go | 5 +++-- .../shirou/gopsutil/v3/mem/mem_aix_nocgo.go | 7 ++----- .../github.com/shirou/gopsutil/v3/net/net_solaris.go | 5 +++-- vendor/modules.txt | 2 +- 7 files changed, 16 insertions(+), 20 deletions(-) diff --git a/go.mod b/go.mod index bb9557a269..83a084c875 100644 --- a/go.mod +++ b/go.mod @@ -55,7 +55,7 @@ require ( github.com/opencontainers/selinux v1.11.0 github.com/openshift/imagebuilder v1.2.6-0.20231127234745-ef2a5fe47510 github.com/rootless-containers/rootlesskit v1.1.1 - github.com/shirou/gopsutil/v3 v3.23.11 + github.com/shirou/gopsutil/v3 v3.23.12 github.com/sirupsen/logrus v1.9.3 github.com/spf13/cobra v1.8.0 github.com/spf13/pflag v1.0.5 diff --git a/go.sum b/go.sum index ab633ca946..b162c29189 100644 --- a/go.sum +++ b/go.sum @@ -964,8 +964,8 @@ github.com/secure-systems-lab/go-securesystemslib v0.7.0/go.mod h1:/2gYnlnHVQ6xe github.com/segmentio/ksuid v1.0.4 h1:sBo2BdShXjmcugAMwjugoGUdUV0pcxY5mW4xKRn3v4c= github.com/segmentio/ksuid v1.0.4/go.mod h1:/XUiZBD3kVx5SmUOl55voK5yeAbBNNIed+2O73XgrPE= github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= -github.com/shirou/gopsutil/v3 v3.23.11 h1:i3jP9NjCPUz7FiZKxlMnODZkdSIp2gnzfrvsu9CuWEQ= -github.com/shirou/gopsutil/v3 v3.23.11/go.mod h1:1FrWgea594Jp7qmjHUUPlJDTPgcsb9mGnXDxavtikzM= +github.com/shirou/gopsutil/v3 v3.23.12 h1:z90NtUkp3bMtmICZKpC4+WaknU1eXtp5vtbQ11DgpE4= +github.com/shirou/gopsutil/v3 v3.23.12/go.mod h1:1FrWgea594Jp7qmjHUUPlJDTPgcsb9mGnXDxavtikzM= github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM= github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ= github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU= diff --git a/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_aix_nocgo.go b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_aix_nocgo.go index 1a291532ad..a77b4dbb76 100644 --- a/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_aix_nocgo.go +++ b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_aix_nocgo.go @@ -5,15 +5,12 @@ package cpu import ( "context" - "regexp" "strconv" "strings" "github.com/shirou/gopsutil/v3/internal/common" ) -var whiteSpaces = regexp.MustCompile(`\s+`) - func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) { if percpu { return []TimesStat{}, common.ErrNotImplementedError @@ -28,8 +25,8 @@ func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) { } ret := TimesStat{CPU: "cpu-total"} - h := whiteSpaces.Split(lines[len(lines)-3], -1) // headers - v := whiteSpaces.Split(lines[len(lines)-2], -1) // values + h := strings.Fields(lines[len(lines)-3]) // headers + v := strings.Fields(lines[len(lines)-2]) // values for i, header := range h { if t, err := strconv.ParseFloat(v[i], 64); err == nil { switch header { @@ -58,14 +55,14 @@ func InfoWithContext(ctx context.Context) ([]InfoStat, error) { ret := InfoStat{} for _, line := range strings.Split(string(out), "\n") { if strings.HasPrefix(line, "Number Of Processors:") { - p := whiteSpaces.Split(line, 4) + p := strings.Fields(line) if len(p) > 3 { if t, err := strconv.ParseUint(p[3], 10, 64); err == nil { ret.Cores = int32(t) } } } else if strings.HasPrefix(line, "Processor Clock Speed:") { - p := whiteSpaces.Split(line, 5) + p := strings.Fields(line) if len(p) > 4 { if t, err := strconv.ParseFloat(p[3], 64); err == nil { switch strings.ToUpper(p[4]) { diff --git a/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_solaris.go b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_solaris.go index f828c843ee..4231ad1681 100644 --- a/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_solaris.go +++ b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_solaris.go @@ -36,6 +36,8 @@ func Times(percpu bool) ([]TimesStat, error) { return TimesWithContext(context.Background(), percpu) } +var kstatSplit = regexp.MustCompile(`[:\s]+`) + func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) { kstatSysOut, err := invoke.CommandWithContext(ctx, "kstat", "-p", "cpu_stat:*:*:/^idle$|^user$|^kernel$|^iowait$|^swap$/") if err != nil { @@ -47,9 +49,8 @@ func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) { kern := make(map[float64]float64) iowt := make(map[float64]float64) // swap := make(map[float64]float64) - re := regexp.MustCompile(`[:\s]+`) for _, line := range strings.Split(string(kstatSysOut), "\n") { - fields := re.Split(line, -1) + fields := kstatSplit.Split(line, -1) if fields[0] != "cpu_stat" { continue } diff --git a/vendor/github.com/shirou/gopsutil/v3/mem/mem_aix_nocgo.go b/vendor/github.com/shirou/gopsutil/v3/mem/mem_aix_nocgo.go index fc9e49222d..cc6a76d2f0 100644 --- a/vendor/github.com/shirou/gopsutil/v3/mem/mem_aix_nocgo.go +++ b/vendor/github.com/shirou/gopsutil/v3/mem/mem_aix_nocgo.go @@ -5,15 +5,12 @@ package mem import ( "context" - "regexp" "strconv" "strings" "github.com/shirou/gopsutil/v3/internal/common" ) -var whiteSpaces = regexp.MustCompile(`\s+`) - func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) { vmem, swap, err := callSVMon(ctx) if err != nil { @@ -49,7 +46,7 @@ func callSVMon(ctx context.Context) (*VirtualMemoryStat, *SwapMemoryStat, error) swap := &SwapMemoryStat{} for _, line := range strings.Split(string(out), "\n") { if strings.HasPrefix(line, "memory") { - p := whiteSpaces.Split(line, 7) + p := strings.Fields(line) if len(p) > 2 { if t, err := strconv.ParseUint(p[1], 10, 64); err == nil { vmem.Total = t * pagesize @@ -65,7 +62,7 @@ func callSVMon(ctx context.Context) (*VirtualMemoryStat, *SwapMemoryStat, error) } } } else if strings.HasPrefix(line, "pg space") { - p := whiteSpaces.Split(line, 4) + p := strings.Fields(line) if len(p) > 3 { if t, err := strconv.ParseUint(p[2], 10, 64); err == nil { swap.Total = t * pagesize diff --git a/vendor/github.com/shirou/gopsutil/v3/net/net_solaris.go b/vendor/github.com/shirou/gopsutil/v3/net/net_solaris.go index 7f1f5c86fe..79d8ac30e2 100644 --- a/vendor/github.com/shirou/gopsutil/v3/net/net_solaris.go +++ b/vendor/github.com/shirou/gopsutil/v3/net/net_solaris.go @@ -23,6 +23,8 @@ func IOCounters(pernic bool) ([]IOCountersStat, error) { return IOCountersWithContext(context.Background(), pernic) } +var kstatSplit = regexp.MustCompile(`[:\s]+`) + func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, error) { // collect all the net class's links with below statistics filterstr := "/^(?!vnic)/::phys:/^rbytes64$|^ipackets64$|^idrops64$|^ierrors$|^obytes64$|^opackets64$|^odrops64$|^oerrors$/" @@ -47,9 +49,8 @@ func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, odrops64arr := make(map[string]uint64) oerrorsarr := make(map[string]uint64) - re := regexp.MustCompile(`[:\s]+`) for _, line := range lines { - fields := re.Split(line, -1) + fields := kstatSplit.Split(line, -1) interfaceName := fields[0] instance := fields[1] switch fields[3] { diff --git a/vendor/modules.txt b/vendor/modules.txt index 980dbd6cad..5ab57079e1 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -950,7 +950,7 @@ github.com/secure-systems-lab/go-securesystemslib/encrypted # github.com/segmentio/ksuid v1.0.4 ## explicit; go 1.12 github.com/segmentio/ksuid -# github.com/shirou/gopsutil/v3 v3.23.11 +# github.com/shirou/gopsutil/v3 v3.23.12 ## explicit; go 1.15 github.com/shirou/gopsutil/v3/common github.com/shirou/gopsutil/v3/cpu