Re: [go-nuts] Unit testing AMQP/build flags for tests

2019-11-19 Thread Sebastien Binet
On Tue, Nov 19, 2019 at 6:37 AM burak serdar wrote: > On Mon, Nov 18, 2019 at 10:24 PM Shane H wrote: > > > > > > > > On Tuesday, November 19, 2019 at 4:11:52 PM UTC+11, burak serdar wrote: > >> > >> > >> > >> This is what I usually do in these situations: > >> > >> var amqpDial=amqp.Dial > >>

Re: [go-nuts] Unit testing AMQP/build flags for tests

2019-11-18 Thread burak serdar
On Mon, Nov 18, 2019 at 10:24 PM Shane H wrote: > > > > On Tuesday, November 19, 2019 at 4:11:52 PM UTC+11, burak serdar wrote: >> >> >> >> This is what I usually do in these situations: >> >> var amqpDial=amqp.Dial >> func (mq *MQ) Connect() (err error) { >> ... >>mq.conn, err = amqpDial(m

Re: [go-nuts] Unit testing AMQP/build flags for tests

2019-11-18 Thread Shane H
On Tuesday, November 19, 2019 at 4:11:52 PM UTC+11, burak serdar wrote: > > > > This is what I usually do in these situations: > > var amqpDial=amqp.Dial > func (mq *MQ) Connect() (err error) { > ... >mq.conn, err = amqpDial(mq.URI) > ... > } > > func TestConnect(t *testing.T) {

Re: [go-nuts] Unit testing AMQP/build flags for tests

2019-11-18 Thread burak serdar
On Mon, Nov 18, 2019 at 10:00 PM Shane H wrote: > > I'm trying to unit test some code (pasted below). I've struggled to find a > way to mock the amqp.Connection, so have decided to go the monkey patching > route. > > The test 'works' but only if I use the following incantation > go test -gcflags

[go-nuts] Unit testing AMQP/build flags for tests

2019-11-18 Thread Shane H
I'm trying to unit test some code (pasted below). I've struggled to find a way to mock the amqp.Connection, so have decided to go the monkey patching route. The test 'works' but only if I use the following incantation go test -gcflags=-l So, my next step is to ensure that -gcflags is set to pr