From 3387ec61230b35a050a3b6ba0f8696edfd19829e Mon Sep 17 00:00:00 2001 From: weidongkl Date: Mon, 8 Apr 2024 15:13:41 +0800 Subject: [PATCH] style: returns procfs build-in error like other parsing methods (#630) Signed-off-by: weidongkl --- cpuinfo.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpuinfo.go b/cpuinfo.go index f4f5501c..d92ab6ae 100644 --- a/cpuinfo.go +++ b/cpuinfo.go @@ -386,7 +386,7 @@ func parseCPUInfoLoong(info []byte) ([]CPUInfo, error) { // find the first "processor" line firstLine := firstNonEmptyLine(scanner) if !strings.HasPrefix(firstLine, "system type") || !strings.Contains(firstLine, ":") { - return nil, errors.New("invalid cpuinfo file: " + firstLine) + return nil, fmt.Errorf("%w: %q", ErrFileParse, firstLine) } field := strings.SplitN(firstLine, ": ", 2) cpuinfo := []CPUInfo{}