Change-Id: I0db93b7bdcd622ce9e23df183de4737744e6d6ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/428294
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
Auto-Submit: Jenny Rakoczy <jenny@golang.org>
Run-TryBot: xie cui <
523516579@qq.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Jenny Rakoczy <jenny@golang.org>
print(extern)
}`)
testStr := "test test test test test \n\\ "
- var buf bytes.Buffer
+ var buf strings.Builder
for buf.Len() < sys.ExecArgLengthLimit+1 {
buf.WriteString(testStr)
}
}
work.BuildInit()
- var buf bytes.Buffer
+ var buf strings.Builder
buf.WriteString(bugHeader)
printGoVersion(&buf)
buf.WriteString("### Does this issue reproduce with the latest release?\n\n\n")
import (
"bufio"
- "bytes"
"fmt"
"io"
"os"
fmt.Fprintln(w, "// Code generated by mkalldocs.sh; DO NOT EDIT.")
fmt.Fprintln(w, "// Edit the documentation in other files and rerun mkalldocs.sh to generate this one.")
fmt.Fprintln(w)
- buf := new(bytes.Buffer)
+ buf := new(strings.Builder)
PrintUsage(buf, base.Go)
usage := &base.Command{Long: buf.String()}
cmds := []*base.Command{usage}
// if those packages are not found in existing dependencies of the main module.
import (
- "bytes"
"context"
"errors"
"fmt"
stack = append(stack, p)
}
- var buf bytes.Buffer
+ var buf strings.Builder
for i := len(stack) - 1; i >= 0; i-- {
p := stack[i]
fmt.Fprint(&buf, p.path)
package work
import (
- "bytes"
"fmt"
"io/fs"
"os"
// Check that `cp` is called instead of `mv` by looking at the output
// of `(*Builder).ShowCmd` afterwards as a sanity check.
cfg.BuildX = true
- var cmdBuf bytes.Buffer
+ var cmdBuf strings.Builder
b.Print = func(a ...any) (int, error) {
return cmdBuf.WriteString(fmt.Sprint(a...))
}
cmdline := str.StringList(cfg.BuildToolexec, path, "-V=full")
cmd := exec.Command(cmdline[0], cmdline[1:]...)
- var stdout, stderr bytes.Buffer
+ var stdout, stderr strings.Builder
cmd.Stdout = &stdout
cmd.Stderr = &stderr
if err := cmd.Run(); err != nil {
if stderr.Len() > 0 {
- os.Stderr.Write(stderr.Bytes())
+ os.Stderr.WriteString(stderr.String())
}
base.Fatalf("go: error obtaining buildID for %s: %v", desc, err)
}
// output unambiguous.
// TODO: See issue 5279. The printing of commands needs a complete redo.
func joinUnambiguously(a []string) string {
- var buf bytes.Buffer
+ var buf strings.Builder
for i, s := range a {
if i > 0 {
buf.WriteByte(' ')