From 58158e990f272774e615c9abd8662bf0198c29aa Mon Sep 17 00:00:00 2001 From: cui fliter Date: Tue, 4 Oct 2022 15:59:56 +0000 Subject: [PATCH] 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 --- src/cmd/go/internal/modfetch/coderepo.go | 2 +- src/cmd/go/internal/modload/build.go | 4 ++-- src/cmd/trace/annotations.go | 2 +- src/net/smtp/auth.go | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/cmd/go/internal/modfetch/coderepo.go b/src/cmd/go/internal/modfetch/coderepo.go index 0aee381e17d..04164ff9a1c 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 bbece3f849f..f5e16e2a926 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 be515880e61..9ffce1b187f 100644 --- a/src/cmd/trace/annotations.go +++ b/src/cmd/trace/annotations.go @@ -1095,7 +1095,7 @@ Search log text: