diff --git a/_scripts/gen-faq-toc.go b/_scripts/gen-faq-toc.go index 3467396f16..aef828ca75 100644 --- a/_scripts/gen-faq-toc.go +++ b/_scripts/gen-faq-toc.go @@ -50,12 +50,12 @@ func spliceDocs(docpath string, docs []byte, outpath string) { footer := v[1] outbuf := bytes.NewBuffer(make([]byte, 0, len(header)+len(docs)+len(footer)+len(startOfToc)+len(endOfToc)+1)) - outbuf.Write([]byte(header)) - outbuf.Write([]byte(startOfToc)) + outbuf.WriteString(header) + outbuf.WriteString(startOfToc) outbuf.WriteByte('\n') outbuf.Write(docs) - outbuf.Write([]byte(endOfToc)) - outbuf.Write([]byte(footer)) + outbuf.WriteString(endOfToc) + outbuf.WriteString(footer) if outpath != "-" { err = os.WriteFile(outpath, outbuf.Bytes(), 0o664) diff --git a/pkg/dwarf/dwarfbuilder/info.go b/pkg/dwarf/dwarfbuilder/info.go index 4e18e5d3a3..194df6322f 100644 --- a/pkg/dwarf/dwarfbuilder/info.go +++ b/pkg/dwarf/dwarfbuilder/info.go @@ -137,7 +137,7 @@ func (b *Builder) Attr(attr dwarf.Attr, val interface{}) dwarf.Offset { switch x := val.(type) { case string: tag.form = append(tag.form, DW_FORM_string) - b.info.Write([]byte(x)) + b.info.WriteString(x) b.info.WriteByte(0) case uint8: tag.form = append(tag.form, DW_FORM_data1) diff --git a/pkg/proc/dump.go b/pkg/proc/dump.go index ebda9d99d9..bb10d300bd 100644 --- a/pkg/proc/dump.go +++ b/pkg/proc/dump.go @@ -273,7 +273,7 @@ func (t *Target) dumpThreadNotes(notes []elfwriter.Note, state *DumpState, th Th for _, reg := range regsv { binary.Write(buf, binary.LittleEndian, uint16(len(reg.Name))) - buf.Write([]byte(reg.Name)) + buf.WriteString(reg.Name) if reg.Reg.Bytes != nil { binary.Write(buf, binary.LittleEndian, uint16(len(reg.Reg.Bytes))) buf.Write(reg.Reg.Bytes) diff --git a/pkg/proc/gdbserial/rr.go b/pkg/proc/gdbserial/rr.go index 03cd781e6d..af5d83bcba 100644 --- a/pkg/proc/gdbserial/rr.go +++ b/pkg/proc/gdbserial/rr.go @@ -258,7 +258,7 @@ func rrStderrParser(stderr io.ReadCloser, initch chan<- rrInit, quiet bool) { } if !quiet { - os.Stderr.Write([]byte(line)) + os.Stderr.WriteString(line) } } diff --git a/pkg/terminal/command.go b/pkg/terminal/command.go index 1a1c399c2f..ea85e7711d 100644 --- a/pkg/terminal/command.go +++ b/pkg/terminal/command.go @@ -3126,7 +3126,7 @@ func (c *Commands) onCmd(t *Term, ctx callContext, argstr string) error { _ = os.Remove(f.Name()) }() attrs := formatBreakpointAttrs("", ctx.Breakpoint, true) - _, err = f.Write([]byte(strings.Join(attrs, "\n"))) + _, err = f.WriteString(strings.Join(attrs, "\n")) if err != nil { return err }