summaryrefslogtreecommitdiffhomepage
path: root/pkg/cpuid
diff options
context:
space:
mode:
authorAdin Scannell <ascannell@google.com>2020-08-25 12:16:31 -0700
committergVisor bot <gvisor-bot@google.com>2020-08-25 12:18:25 -0700
commitb0c53f8475d14606ef82aeddfb2f742269c1b5b7 (patch)
tree758f77d07ea16b97cf1b81729fae0577b87c9f08 /pkg/cpuid
parentb83758cd875be8fea521c6bb51b4ba6b41a690a9 (diff)
Add nogo support to go_binary and go_test targets.
Updates #3374 PiperOrigin-RevId: 328378700
Diffstat (limited to 'pkg/cpuid')
-rw-r--r--pkg/cpuid/cpuid_parse_x86_test.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/pkg/cpuid/cpuid_parse_x86_test.go b/pkg/cpuid/cpuid_parse_x86_test.go
index c9bd40e1b..e4ae0d689 100644
--- a/pkg/cpuid/cpuid_parse_x86_test.go
+++ b/pkg/cpuid/cpuid_parse_x86_test.go
@@ -32,27 +32,27 @@ func kernelVersion() (int, int, error) {
return 0, 0, err
}
- var r string
+ var sb strings.Builder
for _, b := range u.Release {
if b == 0 {
break
}
- r += string(b)
+ sb.WriteByte(byte(b))
}
- s := strings.Split(r, ".")
+ s := strings.Split(sb.String(), ".")
if len(s) < 2 {
- return 0, 0, fmt.Errorf("kernel release missing major and minor component: %s", r)
+ return 0, 0, fmt.Errorf("kernel release missing major and minor component: %s", sb.String())
}
major, err := strconv.Atoi(s[0])
if err != nil {
- return 0, 0, fmt.Errorf("error parsing major version %q in %q: %v", s[0], r, err)
+ return 0, 0, fmt.Errorf("error parsing major version %q in %q: %w", s[0], sb.String(), err)
}
minor, err := strconv.Atoi(s[1])
if err != nil {
- return 0, 0, fmt.Errorf("error parsing minor version %q in %q: %v", s[1], r, err)
+ return 0, 0, fmt.Errorf("error parsing minor version %q in %q: %w", s[1], sb.String(), err)
}
return major, minor, nil