From ae2937ec179fc30ebe0c9b87c31caa09cf19d666 Mon Sep 17 00:00:00 2001 From: Ben Kochie Date: Tue, 14 May 2024 07:41:58 +0200 Subject: [PATCH] Fixup sysfs/system_cpu.go lint errors (#638) Remove unnecessary nil assignment in `sysfs/system_cpu.go` to fix linter errors. Followup to https://github.com/prometheus/procfs/pull/627 Signed-off-by: SuperQ --- sysfs/system_cpu.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sysfs/system_cpu.go b/sysfs/system_cpu.go index ff510437..5b1bec81 100644 --- a/sysfs/system_cpu.go +++ b/sysfs/system_cpu.go @@ -297,7 +297,7 @@ func parseCpufreqCpuinfo(cpuPath string) (*SystemCPUCpufreqStats, error) { } // "total_trans" is the total number of times the CPU has changed frequency. - var cpuinfoFrequencyTransitionsTotal *uint64 = nil + var cpuinfoFrequencyTransitionsTotal *uint64 cpuinfoFrequencyTransitionsTotalUint, err := util.ReadUintFromFile(filepath.Join(cpuPath, "stats", "total_trans")) if err != nil { if !(os.IsNotExist(err) || os.IsPermission(err)) { @@ -308,7 +308,7 @@ func parseCpufreqCpuinfo(cpuPath string) (*SystemCPUCpufreqStats, error) { } // "time_in_state" is the total time spent at each frequency. - var cpuinfoFrequencyDuration *map[uint64]uint64 = nil + var cpuinfoFrequencyDuration *map[uint64]uint64 cpuinfoFrequencyDurationString, err := util.ReadFileNoStat(filepath.Join(cpuPath, "stats", "time_in_state")) if err != nil { if !(os.IsNotExist(err) || os.IsPermission(err)) { @@ -337,7 +337,7 @@ func parseCpufreqCpuinfo(cpuPath string) (*SystemCPUCpufreqStats, error) { } // "trans_table" contains information about all the CPU frequency transitions. - var cpuinfoTransitionTable *[][]uint64 = nil + var cpuinfoTransitionTable *[][]uint64 cpuinfoTransitionTableString, err := util.ReadFileNoStat(filepath.Join(cpuPath, "stats", "trans_table")) if err != nil { if !(os.IsNotExist(err) || os.IsPermission(err)) {