mirror of
https://github.com/golang/go
synced 2024-11-19 16:44:43 -07:00
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/56950 Reviewed-by: Matt Layher <mdlayher@gmail.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Matt Layher <mdlayher@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
776c33ee5e
commit
943dd0fe33
@ -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) {
|
||||
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])
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if o >= 0 && int(o) < len(opnames) && opnames[o] != "" {
|
||||
if int(o) < len(opnames) && opnames[o] != "" {
|
||||
fmt.Fprint(s, opnames[o])
|
||||
return
|
||||
}
|
||||
|
@ -34,7 +34,6 @@ package obj
|
||||
import (
|
||||
"cmd/internal/objabi"
|
||||
"fmt"
|
||||
"log"
|
||||
"math"
|
||||
)
|
||||
|
||||
@ -46,9 +45,6 @@ func Linknew(arch *LinkArch) *Link {
|
||||
ctxt.Pathname = objabi.WorkingDir()
|
||||
|
||||
ctxt.Headtype.Set(objabi.GOOS)
|
||||
if ctxt.Headtype < 0 {
|
||||
log.Fatalf("unknown goos %s", objabi.GOOS)
|
||||
}
|
||||
|
||||
ctxt.Flag_optimize = true
|
||||
ctxt.Framepointer_enabled = objabi.Framepointer_enabled(objabi.GOOS, arch.Name)
|
||||
|
@ -449,9 +449,6 @@ func generateTrace(params *traceParams) (ViewerData, error) {
|
||||
if setGStateErr != nil {
|
||||
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
|
||||
// or outside of the interesting timeframe.
|
||||
|
Loading…
Reference in New Issue
Block a user