mirror of
https://github.com/golang/go
synced 2024-11-19 10:04:56 -07:00
cmd/internal: rewrite fmt.Sprintf("%s", x) to x
Change-Id: I764933f4928bb9d0d119fbfe44a193ce1449b61e Reviewed-on: https://go-review.googlesource.com/6791 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Rob Pike <r@golang.org>
This commit is contained in:
parent
85626a9266
commit
494e317fbf
@ -694,19 +694,19 @@ func deadcode() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// record field tracking references
|
// record field tracking references
|
||||||
fmt_ := ""
|
var buf bytes.Buffer
|
||||||
|
|
||||||
var p *LSym
|
var p *LSym
|
||||||
for s := Ctxt.Allsym; s != nil; s = s.Allsym {
|
for s := Ctxt.Allsym; s != nil; s = s.Allsym {
|
||||||
if strings.HasPrefix(s.Name, "go.track.") {
|
if strings.HasPrefix(s.Name, "go.track.") {
|
||||||
s.Special = 1 // do not lay out in data segment
|
s.Special = 1 // do not lay out in data segment
|
||||||
s.Hide = 1
|
s.Hide = 1
|
||||||
if s.Reachable {
|
if s.Reachable {
|
||||||
fmt_ += fmt.Sprintf("%s", s.Name[9:])
|
buf.WriteString(s.Name[9:])
|
||||||
for p = s.Reachparent; p != nil; p = p.Reachparent {
|
for p = s.Reachparent; p != nil; p = p.Reachparent {
|
||||||
fmt_ += fmt.Sprintf("\t%s", p.Name)
|
buf.WriteString("\t")
|
||||||
|
buf.WriteString(p.Name)
|
||||||
}
|
}
|
||||||
fmt_ += fmt.Sprintf("\n")
|
buf.WriteString("\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
s.Type = SCONST
|
s.Type = SCONST
|
||||||
@ -721,7 +721,7 @@ func deadcode() {
|
|||||||
if !s.Reachable {
|
if !s.Reachable {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
addstrdata(tracksym, fmt_)
|
addstrdata(tracksym, buf.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
func doweak() {
|
func doweak() {
|
||||||
|
@ -155,7 +155,7 @@ func init() {
|
|||||||
|
|
||||||
func Rconv(r int) string {
|
func Rconv(r int) string {
|
||||||
if r >= REG_AL && r-REG_AL < len(Register) {
|
if r >= REG_AL && r-REG_AL < len(Register) {
|
||||||
return fmt.Sprintf("%s", Register[r-REG_AL])
|
return Register[r-REG_AL]
|
||||||
}
|
}
|
||||||
return fmt.Sprintf("Rgok(%d)", r-obj.RBase386)
|
return fmt.Sprintf("Rgok(%d)", r-obj.RBase386)
|
||||||
}
|
}
|
||||||
|
@ -183,16 +183,16 @@ func linkgetline(ctxt *Link, line int32, f **LSym, l *int32) {
|
|||||||
}
|
}
|
||||||
var buf string
|
var buf string
|
||||||
if filepath.IsAbs(file) || strings.HasPrefix(file, "<") {
|
if filepath.IsAbs(file) || strings.HasPrefix(file, "<") {
|
||||||
buf = fmt.Sprintf("%s", file)
|
buf = file
|
||||||
} else {
|
} else {
|
||||||
buf = fmt.Sprintf("%s/%s", ctxt.Pathname, file)
|
buf = ctxt.Pathname + "/" + file
|
||||||
}
|
}
|
||||||
// Remove leading ctxt->trimpath, or else rewrite $GOROOT to $GOROOT_FINAL.
|
// Remove leading ctxt->trimpath, or else rewrite $GOROOT to $GOROOT_FINAL.
|
||||||
if ctxt.Trimpath != "" && haspathprefix(buf, ctxt.Trimpath) {
|
if ctxt.Trimpath != "" && haspathprefix(buf, ctxt.Trimpath) {
|
||||||
if len(buf) == len(ctxt.Trimpath) {
|
if len(buf) == len(ctxt.Trimpath) {
|
||||||
buf = "??"
|
buf = "??"
|
||||||
} else {
|
} else {
|
||||||
buf1 := fmt.Sprintf("%s", buf[len(ctxt.Trimpath)+1:])
|
buf1 := buf[len(ctxt.Trimpath)+1:]
|
||||||
if buf1[0] == '\x00' {
|
if buf1[0] == '\x00' {
|
||||||
buf1 = "??"
|
buf1 = "??"
|
||||||
}
|
}
|
||||||
|
@ -211,7 +211,7 @@ func init() {
|
|||||||
|
|
||||||
func Rconv(r int) string {
|
func Rconv(r int) string {
|
||||||
if REG_AL <= r && r-REG_AL < len(Register) {
|
if REG_AL <= r && r-REG_AL < len(Register) {
|
||||||
return fmt.Sprintf("%s", Register[r-REG_AL])
|
return Register[r-REG_AL]
|
||||||
}
|
}
|
||||||
return fmt.Sprintf("Rgok(%d)", r-obj.RBaseAMD64)
|
return fmt.Sprintf("Rgok(%d)", r-obj.RBaseAMD64)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user