[nanomsg] Re: more updates

  • From: Ondrej Kupka <ondra.cap@xxxxxxxxx>
  • To: Garrett D'Amore <garrett@xxxxxxxxxx>
  • Date: Tue, 22 Apr 2014 20:03:21 +0200

On Apr 22, 2014, at 7:56 PM, Garrett D'Amore wrote:

> (Sorry for those of you not using Go… maybe its getting to be time to spawn 
> another mailing list. :-)
> 

Yeah, we could do that :D

>> 
>> I think that if you can do tcp.RegisterTransport(), you can also do this 
>> from the tcp package in init(). You are probably talking about a scenario 
>> where you need to do mangos.RegisterTransport(tcp.Transport()). Personally I 
>> don't really have anything against having to write that… I mean yeah, it is 
>> sort of unfortunate, but I don't know any better solution right now...
>> 
> 
> The problem is that doing it from the tcp package’s init() routine isn’t 
> strictly sufficient, because if I don’t have any reference to the tcp package 
> from my application, then the Go compiler will complain about tcp being an 
> unused import.
> 
>       - Garrett

I thought that doing

import (
    _ "tcp"
)

is exactly for the purpose of hidden initialization… It cancels the unused 
import error. So in case all you need is to import mangos and call 
RegisterFactory or so, you can do it in tcp's init and just ask the user to use 
the import specified above.

Regards,
Ondrej

Other related posts: