If you really need this, Svett Ralchev provides a nice example using 
sync.Once() in his blog:
http://blog.ralch.com/tutorial/design-patterns/golang-singleton/

On Thursday, June 30, 2016 at 8:29:32 AM UTC+2, krma...@gmail.com wrote:

> I want a single instance of a client handle to be initialized.
>
> Is it ok to declare the instance as
>
> var client MetricsClient
>
> and then initialize it using sync.Once().
>
> Is it required for some reason that the client be a pointer  or are there 
> are other issues with it. My requirement is to be able to initialize that 
> handle just once 
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to