1
0
mirror of https://github.com/golang/go synced 2024-11-23 19:40:08 -07:00

cmd: replace x[i:][0] expressions with x[i]

Passes toolstash -cmp.

Change-Id: Id504e71ed1f23900e24a9aed25143c94f4d7d50c
Reviewed-on: https://go-review.googlesource.com/21899
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Matthew Dempsky 2016-04-12 12:16:20 -07:00
parent 98080a6c64
commit e07a4459a1
6 changed files with 7 additions and 8 deletions

View File

@ -1087,7 +1087,7 @@ func aclass(ctxt *obj.Link, a *obj.Addr) int {
func oplook(ctxt *obj.Link, p *obj.Prog) *Optab {
a1 := int(p.Optab)
if a1 != 0 {
return &optab[a1-1:][0]
return &optab[a1-1]
}
a1 = int(p.From.Class)
if a1 == 0 {

View File

@ -611,7 +611,7 @@ func oplook(ctxt *obj.Link, p *obj.Prog) *Optab {
a1 := int(p.Optab)
if a1 != 0 {
return &optab[a1-1:][0]
return &optab[a1-1]
}
a1 = int(p.From.Class)
if a1 == 0 {

View File

@ -606,7 +606,7 @@ func aclass(ctxt *obj.Link, a *obj.Addr) int {
func oplook(ctxt *obj.Link, p *obj.Prog) *Optab {
a1 := int(p.Optab)
if a1 != 0 {
return &optab[a1-1:][0]
return &optab[a1-1]
}
a1 = int(p.From.Class)
if a1 == 0 {

View File

@ -4452,9 +4452,8 @@ func asmins(ctxt *obj.Link, p *obj.Prog) {
}
n := ctxt.AsmBuf.Len()
var r *obj.Reloc
for i := len(ctxt.Cursym.R) - 1; i >= 0; i-- {
r = &ctxt.Cursym.R[i:][0]
r := &ctxt.Cursym.R[i]
if int64(r.Off) < p.Pc {
break
}

View File

@ -17,9 +17,9 @@ import (
// ../gc/reflect.c stuffs in these.
func decode_reloc(s *LSym, off int32) *Reloc {
for i := 0; i < len(s.R); i++ {
for i := range s.R {
if s.R[i].Off == off {
return &s.R[i:][0]
return &s.R[i]
}
}
return nil

View File

@ -774,7 +774,7 @@ func ldelf(f *bio.Reader, pkg string, length int64, pn string) {
if sym.sym == nil {
continue
}
sect = &elfobj.sect[sym.shndx:][0]
sect = &elfobj.sect[sym.shndx]
if sect.sym == nil {
if strings.HasPrefix(sym.name, ".Linfo_string") { // clang does this
continue