]> Cypherpunks repositories - gostls13.git/commitdiff
all: use fmt.Appendf
authorcui fliter <imcusg@gmail.com>
Tue, 4 Oct 2022 15:59:56 +0000 (15:59 +0000)
committerGopher Robot <gobot@golang.org>
Tue, 4 Oct 2022 22:43:12 +0000 (22:43 +0000)
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>

src/cmd/go/internal/modfetch/coderepo.go
src/cmd/go/internal/modload/build.go
src/cmd/trace/annotations.go
src/net/smtp/auth.go

index 0aee381e17d53c61ec3757948e534ff49700b640..04164ff9a1c52f4c6a83465e2cc915fbbc5d1de2 100644 (file)
@@ -962,7 +962,7 @@ func (r *codeRepo) GoMod(version string) (data []byte, err error) {
 // 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 {
index bbece3f849f099ca91d16d22305a05d406a3b7eb..f5e16e2a926747d7157e8a096bd2bab0275da469 100644 (file)
@@ -431,12 +431,12 @@ func ModInfoProg(info string, isgccgo bool) []byte {
        // 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
 }
index be515880e61277180ae208c513f503e422010d62..9ffce1b187f2f478aae1fce61b66c3c7d78710af 100644 (file)
@@ -1095,7 +1095,7 @@ Search log text: <form onsubmit="window.location.search+='&logtext='+window.logt
 `))
 
 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.
index 7a32ef6a2e615b4cb7b88b04aced247e3993b26b..72eb16671f8e2f16114f6e410e8ef5b19acd81a2 100644 (file)
@@ -103,7 +103,7 @@ func (a *cramMD5Auth) Next(fromServer []byte, more bool) ([]byte, error) {
                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
 }