]> Cypherpunks repositories - gostls13.git/commitdiff
all: remove redundant string conversions when formatting []byte with %s
authorcui fliter <imcusg@gmail.com>
Thu, 7 Mar 2024 03:16:17 +0000 (11:16 +0800)
committerGopher Robot <gobot@golang.org>
Thu, 7 Mar 2024 20:46:32 +0000 (20:46 +0000)
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>

src/cmd/covdata/tool_test.go
src/cmd/dist/testjson.go
src/net/http/cgi/host.go

index d99113ebc556d56d070b25aa128fd5ea8ad8d1f7..4e56f3579872eee4d840549b158e48d6790973e5 100644 (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))
index 62045932a9f92b99d065e0629eb06d8e2e976744..c190c665ebf779cf02931cd82847fed5df31952f 100644 (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
index ef222ab73a75c0ce2c6d897bd635470f503ca071..c03fabb80772f1038fd1fa8e71d40197db0f7ca9 100644 (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) {