Skip to content

Commit

Permalink
all: remove redundant string conversions when formatting []byte with %s
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
cuishuang authored and pull[bot] committed May 7, 2024
1 parent 1449dcc commit 6680056
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/cmd/covdata/tool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/dist/testjson.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/net/http/cgi/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 6680056

Please sign in to comment.