move all the buffer references to util/buf

This commit is contained in:
Asim Aslam
2019-07-28 19:33:24 +01:00
parent f2669e7b1e
commit 1db98ee0f0
9 changed files with 25 additions and 64 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

@@ -2,7 +2,6 @@
package grpc
import (
"bytes"
"context"
"crypto/tls"
"fmt"
@@ -19,6 +18,7 @@ import (
"github.com/micro/go-micro/registry"
"github.com/micro/go-micro/transport"
"github.com/micro/go-micro/util/buf"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/encoding"
@@ -491,7 +491,8 @@ func (g *grpcClient) Publish(ctx context.Context, p client.Message, opts ...clie
return errors.InternalServerError("go.micro.client", err.Error())
}
b := &buffer{bytes.NewBuffer(nil)}
b := buf.New(nil)
if err := cf(b).Write(&codec.Message{Type: codec.Event}, p.Payload()); err != nil {
return errors.InternalServerError("go.micro.client", err.Error())
}