From: cui fliter Date: Tue, 4 Oct 2022 15:59:56 +0000 (+0000) Subject: all: use fmt.Appendf X-Git-Tag: go1.20rc1~742 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=58158e990f272774e615c9abd8662bf0198c29aa;p=gostls13.git all: use fmt.Appendf 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 Reviewed-by: Bryan Mills TryBot-Result: Gopher Robot Auto-Submit: Ian Lance Taylor Auto-Submit: Bryan Mills Run-TryBot: Bryan Mills Run-TryBot: Ian Lance Taylor --- diff --git a/src/cmd/go/internal/modfetch/coderepo.go b/src/cmd/go/internal/modfetch/coderepo.go index 0aee381e17..04164ff9a1 100644 --- a/src/cmd/go/internal/modfetch/coderepo.go +++ b/src/cmd/go/internal/modfetch/coderepo.go @@ -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 { diff --git a/src/cmd/go/internal/modload/build.go b/src/cmd/go/internal/modload/build.go index bbece3f849..f5e16e2a92 100644 --- a/src/cmd/go/internal/modload/build.go +++ b/src/cmd/go/internal/modload/build.go @@ -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 } diff --git a/src/cmd/trace/annotations.go b/src/cmd/trace/annotations.go index be515880e6..9ffce1b187 100644 --- a/src/cmd/trace/annotations.go +++ b/src/cmd/trace/annotations.go @@ -1095,7 +1095,7 @@ Search log text: