Wrap errors so that they can be unwrapped

This commit is contained in:
Holger Obermaier
2026-02-11 13:51:58 +01:00
parent ca95494a83
commit 6bfdd6ff17
9 changed files with 35 additions and 42 deletions

View File

@@ -76,7 +76,7 @@ func (m *CPUFreqCollector) Init(config json.RawMessage) error {
scalingCurFreqFile := filepath.Join("/sys/devices/system/cpu", fmt.Sprintf("cpu%d", c.CpuID), "cpufreq/scaling_cur_freq")
err := unix.Access(scalingCurFreqFile, unix.R_OK)
if err != nil {
return fmt.Errorf("unable to access file '%s': %v", scalingCurFreqFile, err)
return fmt.Errorf("unable to access file '%s': %w", scalingCurFreqFile, err)
}
m.topology = append(m.topology,