app/vmselect/prometheus: check for errors returned from bufferedwriter.Write

This makes `make errcheck` happy
This commit is contained in:
Aliaksandr Valialkin 2020-09-29 11:36:12 +03:00
parent 6fdfc67620
commit 96ee276e6e

View file

@ -96,9 +96,9 @@ func FederateHandler(startTime time.Time, w http.ResponseWriter, r *http.Request
} }
bb := quicktemplate.AcquireByteBuffer() bb := quicktemplate.AcquireByteBuffer()
WriteFederate(bb, rs) WriteFederate(bb, rs)
bw.Write(bb.B) _, err := bw.Write(bb.B)
quicktemplate.ReleaseByteBuffer(bb) quicktemplate.ReleaseByteBuffer(bb)
return nil return err
}) })
if err != nil { if err != nil {
return fmt.Errorf("error during data fetching: %w", err) return fmt.Errorf("error during data fetching: %w", err)
@ -153,7 +153,7 @@ func ExportNativeHandler(startTime time.Time, w http.ResponseWriter, r *http.Req
trBuf := make([]byte, 0, 16) trBuf := make([]byte, 0, 16)
trBuf = encoding.MarshalInt64(trBuf, start) trBuf = encoding.MarshalInt64(trBuf, start)
trBuf = encoding.MarshalInt64(trBuf, end) trBuf = encoding.MarshalInt64(trBuf, end)
bw.Write(trBuf) _, _ = bw.Write(trBuf)
// Marshal native blocks. // Marshal native blocks.
err = netstorage.ExportBlocks(sq, deadline, func(mn *storage.MetricName, b *storage.Block, tr storage.TimeRange) error { err = netstorage.ExportBlocks(sq, deadline, func(mn *storage.MetricName, b *storage.Block, tr storage.TimeRange) error {
@ -178,11 +178,11 @@ func ExportNativeHandler(startTime time.Time, w http.ResponseWriter, r *http.Req
tmpBuf.B = tmp tmpBuf.B = tmp
bbPool.Put(tmpBuf) bbPool.Put(tmpBuf)
bw.Write(dst) _, err := bw.Write(dst)
dstBuf.B = dst dstBuf.B = dst
bbPool.Put(dstBuf) bbPool.Put(dstBuf)
return nil return err
}) })
if err != nil { if err != nil {
return err return err