Skip to content

Commit 3387ec6

Browse files
authored
style: returns procfs build-in error like other parsing methods (prometheus#630)
Signed-off-by: weidongkl <[email protected]>
1 parent 5819c81 commit 3387ec6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cpuinfo.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ func parseCPUInfoLoong(info []byte) ([]CPUInfo, error) {
386386
// find the first "processor" line
387387
firstLine := firstNonEmptyLine(scanner)
388388
if !strings.HasPrefix(firstLine, "system type") || !strings.Contains(firstLine, ":") {
389-
return nil, errors.New("invalid cpuinfo file: " + firstLine)
389+
return nil, fmt.Errorf("%w: %q", ErrFileParse, firstLine)
390390
}
391391
field := strings.SplitN(firstLine, ": ", 2)
392392
cpuinfo := []CPUInfo{}

0 commit comments

Comments
 (0)