mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-11 13:18:53 +00:00
logtail, net/portmapper, wgengine/magicsock: use fmt.Appendf
Fixes #5206 Change-Id: I490bb92e774ce7c044040537e2cd864fcf1dbe5a Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:

committed by
Brad Fitzpatrick

parent
4aa88bc2c0
commit
5381437664
@@ -5,7 +5,6 @@
|
||||
package logtail
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"sync"
|
||||
@@ -51,9 +50,7 @@ func (m *memBuffer) TryReadLine() ([]byte, error) {
|
||||
case ent := <-m.pending:
|
||||
if ent.dropCount > 0 {
|
||||
m.next = ent.msg
|
||||
buf := new(bytes.Buffer)
|
||||
fmt.Fprintf(buf, "----------- %d logs dropped ----------", ent.dropCount)
|
||||
return buf.Bytes(), nil
|
||||
return fmt.Appendf(nil, "----------- %d logs dropped ----------", ent.dropCount), nil
|
||||
}
|
||||
return ent.msg, nil
|
||||
default:
|
||||
|
@@ -270,7 +270,7 @@ func (l *Logger) drainPending(scratch []byte) (res []byte) {
|
||||
if err == io.EOF {
|
||||
break
|
||||
} else if err != nil {
|
||||
b = []byte(fmt.Sprintf("reading ringbuffer: %v", err))
|
||||
b = fmt.Appendf(nil, "reading ringbuffer: %v", err)
|
||||
batchDone = true
|
||||
} else if b == nil {
|
||||
if entries > 0 {
|
||||
|
Reference in New Issue
Block a user