move all the buffer references to util/buf

This commit is contained in:
Asim Aslam 2019-07-28 19:33:24 +01:00 committed by Vasiliy Tolstov
parent c0e32da83e
commit 7d6efd8a74
2 changed files with 2 additions and 15 deletions

View File

@ -1,14 +0,0 @@
package grpc
import (
"bytes"
)
type buffer struct {
*bytes.Buffer
}
func (b *buffer) Close() error {
b.Buffer.Reset()
return nil
}

View File

@ -12,6 +12,7 @@ import (
"github.com/micro/go-micro/metadata" "github.com/micro/go-micro/metadata"
"github.com/micro/go-micro/registry" "github.com/micro/go-micro/registry"
"github.com/micro/go-micro/server" "github.com/micro/go-micro/server"
"github.com/micro/go-micro/util/buf"
) )
const ( const (
@ -204,7 +205,7 @@ func (g *grpcServer) createSubHandler(sb *subscriber, opts server.Options) broke
req = req.Elem() req = req.Elem()
} }
b := &buffer{bytes.NewBuffer(msg.Body)} b := buf.New(bytes.NewBuffer(msg.Body))
co := cf(b) co := cf(b)
defer co.Close() defer co.Close()