From b363c210f26f6dd350792fa2ce934716c640cce1 Mon Sep 17 00:00:00 2001 From: Simon Eisenmann Date: Tue, 5 Apr 2016 17:30:57 +0200 Subject: [PATCH] Wrap nats connections as reference. --- go/natsconnection/natsconnection.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/go/natsconnection/natsconnection.go b/go/natsconnection/natsconnection.go index f4acb1ae..db9cdc47 100644 --- a/go/natsconnection/natsconnection.go +++ b/go/natsconnection/natsconnection.go @@ -18,12 +18,12 @@ var DefaultURL = nats.DefaultURL // Connection implements the wrapped nats.Conn. type Connection struct { - nats.Conn + *nats.Conn } // EncodedConnection implements the wrapped nats.EncodedConn. type EncodedConnection struct { - nats.EncodedConn + *nats.EncodedConn } // NewConnection creates a connetion to the default NATS server @@ -55,7 +55,7 @@ func NewConnection() (*Connection, error) { return nil, err } - return &Connection{*nc}, nil + return &Connection{nc}, nil } // NewJSONEncodedConnection creates a JSON-encoded connetion to the @@ -67,11 +67,11 @@ func NewJSONEncodedConnection() (*EncodedConnection, error) { if err != nil { return nil, err } - ec, err := nats.NewEncodedConn(&nc.Conn, nats.JSON_ENCODER) + ec, err := nats.NewEncodedConn(nc.Conn, nats.JSON_ENCODER) if err != nil { return nil, err } - return &EncodedConnection{*ec}, nil + return &EncodedConnection{ec}, nil } // EstablishConnection is a blocking way to create and establish @@ -129,9 +129,9 @@ func EstablishJSONEncodedConnection(timeout *time.Duration) (*EncodedConnection, if err != nil { return nil, err } - ec, err := nats.NewEncodedConn(&nc.Conn, nats.JSON_ENCODER) + ec, err := nats.NewEncodedConn(nc.Conn, nats.JSON_ENCODER) if err != nil { return nil, err } - return &EncodedConnection{*ec}, nil + return &EncodedConnection{ec}, nil }