bitly/go-nsq — pull request #93 by dcarney (2014-11-18 22:41:55+00:00)
Title: Makes Consumer.ConnectToNSQLookupd return an error when invoked with an ...

Currently, the ConnectToNSQLookupd method on Consumer fails to return any error when invoked with an invalid nsqlookupd address. Instead the error is logged (and swallowed) in the queryLookupd func, right after the call to apiRequestNegotiateV1, since queryLookupd doesn't return anything. This leaves a consumer with no reliable way to tell that the lookupd address provided was invalid.

To repro:

func foo() {
q, _ := nsq.NewConsumer("the-topic", "the-channel", nsq.NewConfig())

handler := &SomeHandler{}
q.AddHandler(handler)
err := q.ConnectToNSQLookupd("1.2.3.4:9999")
// err is nil!
}