]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: simplify slice expression to sliced value itself
authorIskander Sharipov <iskander.sharipov@intel.com>
Wed, 11 Jul 2018 20:34:18 +0000 (23:34 +0300)
committerBrad Fitzpatrick <bradfitz@golang.org>
Wed, 22 Aug 2018 19:48:18 +0000 (19:48 +0000)
Replace `x[:]` where x is a slice with just `x`.

Found using https://go-critic.github.io/overview.html#unslice-ref

Change-Id: Ib0ee16e1d49b2a875b6b92a770049acc33208362
Reviewed-on: https://go-review.googlesource.com/123375
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/runtime/trace.go

index 61f7513ee0e5aa0077cff973d568b443f60261b8..22d8d026dc67c0947323809acf56add4371bcb08 100644 (file)
@@ -584,10 +584,10 @@ func traceStackID(mp *m, buf []uintptr, skip int) uint64 {
        gp := mp.curg
        var nstk int
        if gp == _g_ {
-               nstk = callers(skip+1, buf[:])
+               nstk = callers(skip+1, buf)
        } else if gp != nil {
                gp = mp.curg
-               nstk = gcallers(gp, skip, buf[:])
+               nstk = gcallers(gp, skip, buf)
        }
        if nstk > 0 {
                nstk-- // skip runtime.goexit