Explorar o código

also resize value when error

Darien Raymond %!s(int64=9) %!d(string=hai) anos
pai
achega
85f9e39416
Modificáronse 1 ficheiros con 1 adicións e 3 borrados
  1. 1 3
      common/alloc/buffer.go

+ 1 - 3
common/alloc/buffer.go

@@ -190,9 +190,7 @@ func (b *Buffer) FillFrom(reader io.Reader) (int, error) {
 	begin := b.Len()
 	b.Value = b.Value[:cap(b.Value)]
 	nBytes, err := reader.Read(b.Value[begin:])
-	if err == nil {
-		b.Value = b.Value[:begin+nBytes]
-	}
+	b.Value = b.Value[:begin+nBytes]
 	return nBytes, err
 }