Change-Id: I45f941ba3db26a12b3f56d93bdcd7f9e1d490346
GitHub-Last-Rev:
22b51167b08a1770a63a8b768a60451bc2ff0dc5
GitHub-Pull-Request: golang/go#56030
Reviewed-on: https://go-review.googlesource.com/c/go/+/438539
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
// for dependencies in the middle of a build, impossible to
// correct. So we stopped.
func LegacyGoMod(modPath string) []byte {
- return []byte(fmt.Sprintf("module %s\n", modfile.AutoQuote(modPath)))
+ return fmt.Appendf(nil, "module %s\n", modfile.AutoQuote(modPath))
}
func (r *codeRepo) modPrefix(rev string) string {
// look at the module info in their init functions (see issue 29628),
// which won't work. See also issue 30344.
if isgccgo {
- return []byte(fmt.Sprintf(`package main
+ return fmt.Appendf(nil, `package main
import _ "unsafe"
//go:linkname __set_debug_modinfo__ runtime.setmodinfo
func __set_debug_modinfo__(string)
func init() { __set_debug_modinfo__(%q) }
-`, ModInfoData(info)))
+`, ModInfoData(info))
}
return nil
}
`))
func elapsed(d time.Duration) string {
- b := []byte(fmt.Sprintf("%.9f", d.Seconds()))
+ b := fmt.Appendf(nil, "%.9f", d.Seconds())
// For subsecond durations, blank all zeros before decimal point,
// and all zeros between the decimal point and the first non-zero digit.
d := hmac.New(md5.New, []byte(a.secret))
d.Write(fromServer)
s := make([]byte, 0, d.Size())
- return []byte(fmt.Sprintf("%s %x", a.username, d.Sum(s))), nil
+ return fmt.Appendf(nil, "%s %x", a.username, d.Sum(s)), nil
}
return nil, nil
}