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 <weidong@uniontech.com>
  • Loading branch information
weidongkl committed 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
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.