A small nitpick:
At line 181, https://github.com/prometheus/procfs/blob/master/stat.go#L181, the comment is passed as:
// parseStat parses the metrics from /proc/[pid]/stat.
however, parseStat parses the system-wide /proc/stat file rather than /proc/[pid]/stat, so the comment appears to be inaccurate.
Repetitive method calling:
In the same function:
buf := make([]byte, 0, 8*1024)
scanner.Buffer(buf, 1024*1024)
for scanner.Scan() {
line := scanner.Text()
parts := strings.Fields(scanner.Text())
(Line https://github.com/prometheus/procfs/blob/master/stat.go#L197)
Since line already contains the current scanner text, this could instead be:
parts := strings.Fields(line)
They both are very small issues but worth noting.
If accepted I would like to make a PR for these changes.
A small nitpick:
At line 181, https://github.com/prometheus/procfs/blob/master/stat.go#L181, the comment is passed as:
// parseStat parses the metrics from /proc/[pid]/stat.however, parseStat parses the system-wide /proc/stat file rather than /proc/[pid]/stat, so the comment appears to be inaccurate.
Repetitive method calling:
In the same function:
(Line https://github.com/prometheus/procfs/blob/master/stat.go#L197)
Since
linealready contains the current scanner text, this could instead be:parts := strings.Fields(line)They both are very small issues but worth noting.
If accepted I would like to make a PR for these changes.