1
0
mirror of https://github.com/golang/go synced 2024-11-16 20:54:48 -07:00

all: remove redundant string conversions when formatting []byte with %s

Change-Id: I1285ee047fd465f48028186ae04d4de60cc9969e
Reviewed-on: https://go-review.googlesource.com/c/go/+/569715
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: shuang cui <imcusg@gmail.com>
Reviewed-by: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
cui fliter 2024-03-07 11:16:17 +08:00 committed by Gopher Robot
parent 7101fd1e97
commit 8d3703ed77
3 changed files with 3 additions and 3 deletions

View File

@ -294,7 +294,7 @@ func runToolOp(t *testing.T, s state, op string, args []string) []string {
cmd := testenv.Command(t, s.tool, args...)
b, err := cmd.CombinedOutput()
if err != nil {
fmt.Fprintf(os.Stderr, "## %s output: %s\n", op, string(b))
fmt.Fprintf(os.Stderr, "## %s output: %s\n", op, b)
t.Fatalf("%q run error: %v", op, err)
}
output := strings.TrimSpace(string(b))

View File

@ -99,7 +99,7 @@ func (f *testJSONFilter) process(line []byte) {
data, err := json.Marshal(val)
if err != nil {
// Should never happen.
panic(fmt.Sprintf("failed to round-trip JSON %q: %s", string(line), err))
panic(fmt.Sprintf("failed to round-trip JSON %q: %s", line, err))
}
f.w.Write(data)
// Copy any trailing text. We expect at most a "\n" here, but

View File

@ -277,7 +277,7 @@ func (h *Handler) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
headerLines++
header, val, ok := strings.Cut(string(line), ":")
if !ok {
h.printf("cgi: bogus header line: %s", string(line))
h.printf("cgi: bogus header line: %s", line)
continue
}
if !httpguts.ValidHeaderFieldName(header) {