Skip to content

Commit

Permalink
style: returns procfs build-in error like other parsing methods (prom…
Browse files Browse the repository at this point in the history
…etheus#630)

Signed-off-by: weidongkl <[email protected]>
  • Loading branch information
wd3993 authored and jritter committed Jul 15, 2024
1 parent 76ea9de commit cb8d660
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 cb8d660

Please sign in to comment.