Skip to content

Commit

Permalink
style: returns procfs build-in error like other parsing methods (#630)
Browse files Browse the repository at this point in the history
Signed-off-by: weidongkl <[email protected]>
  • Loading branch information
wd3993 authored Apr 8, 2024
1 parent 5819c81 commit 3387ec6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cpuinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down

0 comments on commit 3387ec6

Please sign in to comment.