Skip to content

Commit

Permalink
Cast bytes to string
Browse files Browse the repository at this point in the history
  • Loading branch information
Chad Harp committed Jun 7, 2019
1 parent 16b37cc commit 8c6072d
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions cpu/cpu_solaris.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package cpu

import (
"bytes"
"context"
"errors"
"fmt"
Expand Down Expand Up @@ -59,7 +58,7 @@ func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) {
return nil, fmt.Errorf("cannot execute kstat: %s", err)
}
re := regexp.MustCompile(`[:\s]+`)
for _, line := range strings.Split(bytes.NewBuffer(kstatSysOut).String(), "\n") {
for _, line := range strings.Split(string(kstatSysOut), "\n") {
fields := re.Split(line, -1)
if fields[0] != "cpu_stat" {
continue
Expand Down

0 comments on commit 8c6072d

Please sign in to comment.