Commit 943dd0fe authored by Daniel Martí's avatar Daniel Martí

cmd/*: remove negative uint checks

All of these are uints of different sizes, so checking >= 0 or < 0 are
effectively no-ops.

Found with staticcheck.

Change-Id: I16ac900eb7007bc8f9018b302136d42e483a4180
Reviewed-on: https://go-review.googlesource.com/56950Reviewed-by: default avatarMatt Layher <mdlayher@gmail.com>
Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 776c33ee
...@@ -227,13 +227,13 @@ func (o Op) format(s fmt.State, verb rune, mode fmtMode) { ...@@ -227,13 +227,13 @@ func (o Op) format(s fmt.State, verb rune, mode fmtMode) {
func (o Op) oconv(s fmt.State, flag FmtFlag, mode fmtMode) { func (o Op) oconv(s fmt.State, flag FmtFlag, mode fmtMode) {
if flag&FmtSharp != 0 || mode != FDbg { if flag&FmtSharp != 0 || mode != FDbg {
if o >= 0 && int(o) < len(goopnames) && goopnames[o] != "" { if int(o) < len(goopnames) && goopnames[o] != "" {
fmt.Fprint(s, goopnames[o]) fmt.Fprint(s, goopnames[o])
return return
} }
} }
if o >= 0 && int(o) < len(opnames) && opnames[o] != "" { if int(o) < len(opnames) && opnames[o] != "" {
fmt.Fprint(s, opnames[o]) fmt.Fprint(s, opnames[o])
return return
} }
......
...@@ -34,7 +34,6 @@ package obj ...@@ -34,7 +34,6 @@ package obj
import ( import (
"cmd/internal/objabi" "cmd/internal/objabi"
"fmt" "fmt"
"log"
"math" "math"
) )
...@@ -46,9 +45,6 @@ func Linknew(arch *LinkArch) *Link { ...@@ -46,9 +45,6 @@ func Linknew(arch *LinkArch) *Link {
ctxt.Pathname = objabi.WorkingDir() ctxt.Pathname = objabi.WorkingDir()
ctxt.Headtype.Set(objabi.GOOS) ctxt.Headtype.Set(objabi.GOOS)
if ctxt.Headtype < 0 {
log.Fatalf("unknown goos %s", objabi.GOOS)
}
ctxt.Flag_optimize = true ctxt.Flag_optimize = true
ctxt.Framepointer_enabled = objabi.Framepointer_enabled(objabi.GOOS, arch.Name) ctxt.Framepointer_enabled = objabi.Framepointer_enabled(objabi.GOOS, arch.Name)
......
...@@ -449,9 +449,6 @@ func generateTrace(params *traceParams) (ViewerData, error) { ...@@ -449,9 +449,6 @@ func generateTrace(params *traceParams) (ViewerData, error) {
if setGStateErr != nil { if setGStateErr != nil {
return ctx.data, setGStateErr return ctx.data, setGStateErr
} }
if ctx.gstates[gRunnable] < 0 || ctx.gstates[gRunning] < 0 || ctx.threadStats.insyscall < 0 {
return ctx.data, fmt.Errorf("invalid state after processing %v: runnable=%d running=%d insyscall=%d", ev, ctx.gstates[gRunnable], ctx.gstates[gRunning], ctx.threadStats.insyscall)
}
// Ignore events that are from uninteresting goroutines // Ignore events that are from uninteresting goroutines
// or outside of the interesting timeframe. // or outside of the interesting timeframe.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment