From 5ffb563051a760d81f8ad226bff340bafd930671 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Mon, 16 Sep 2019 16:51:46 +0000 Subject: [PATCH] refactor: eliminate ReadBytes() function that is only called once --- report/marshal.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/report/marshal.go b/report/marshal.go index 044cf3750..b67993d5f 100644 --- a/report/marshal.go +++ b/report/marshal.go @@ -102,7 +102,7 @@ func (rep *Report) ReadBinary(ctx context.Context, r io.Reader, gzipped bool, ms if err != nil { return err } - if err := rep.ReadBytes(buf.Bytes(), codecHandle(msgpack)); err != nil { + if err := codec.NewDecoderBytes(buf.Bytes(), codecHandle(msgpack)).Decode(&rep); err != nil { return err } log.Debugf( @@ -124,11 +124,6 @@ func MakeFromBinary(ctx context.Context, r io.Reader) (*Report, error) { return &rep, nil } -// ReadBytes reads bytes into a Report, using a codecHandle. -func (rep *Report) ReadBytes(buf []byte, codecHandle codec.Handle) error { - return codec.NewDecoderBytes(buf, codecHandle).Decode(&rep) -} - // MakeFromFile construct a Report from a file, with the encoding // determined by the extension (".msgpack" or ".json", with an // optional ".gz").