On Sunday, August 21, 2016 at 3:04:02 PM UTC-7, Asit Dhal wrote:
>
> Hi all,
> I use defer to release resource at function level.
>
> func test() {
> a := A.Open()
> defer a.Close()
> //other code
> }
>
> I need the object a, to be wrapped in a struct. Can someone tell me how to
> make
Try it out :) seems like a simple enough test program to write.
--
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
Do you have a code sample? I don't quite understand what you mean by something
being "wrapped" in a struct. Will 'a' be a field in a struct? If so, you can
just access it:
defer myStructValue.a.Close()
--
You received this message because you are subscribed to the Google Groups
"golang-nuts"
On Sunday, August 21, 2016 at 5:50:52 PM UTC-7, Axel Wagner wrote:
>
> Yes. When you save A in a variable (or parameter) of type C, the compiler
> emits code to create an interface value and puts a pointer to A in it
> (together with a dispatch table for the interface functions, AIUI). But
>
The documentation of rate.Limiter.WaitN function says that it blocks until
lim permits n events to happen and that it returns an error if n exceeds
the Limiter's burst size.
However the documentation of rate.Limiter type says that, as a special
case, if rate limit is Inf, burst size is ignored.
On 21/08/2016 21:51, Jan Mercl wrote:
On Sun, Aug 21, 2016, 22:43 Steven Hartland > wrote:
If I have multiple goroutines reading from a channel are they
guaranteed to be FIFO i.e. is the handler that requested the read
first
Hi all,
I use defer to release resource at function level.
func test() {
a := A.Open()
defer a.Close()
//other code
}
I need the object a, to be wrapped in a struct. Can someone tell me how to make
a.Close() in this case elegantly ?
Warm Regards,
Asit Dhal
http://bit.ly/193ASIT
--
You
I had deleted the question, planning on expanding before reposting,
On Sunday, August 21, 2016 at 12:00:51 PM UTC-7, Axel Wagner wrote:
>
> I think if you want this to happen (you're far from the first, there is
> even a github-issue, AFAIK, but I'm too lazy to find it right now) you also
On Sun, Aug 21, 2016, 22:43 Steven Hartland wrote:
> If I have multiple goroutines reading from a channel are they guaranteed
> to be FIFO i.e. is the handler that requested the read first guaranteed to
> get the first value, second to get the second and so on?
>
> Values
No. See what a select statement says about order when multiple cases are
choosable: not defined, and the implementation guarantees uniform randomness
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop
If I have multiple goroutines reading from a channel are they guaranteed
to be FIFO i.e. is the handler that requested the read first guaranteed
to get the first value, second to get the second and so on?
Regards
Steve
--
You received this message because you are subscribed to the
You can access the global mux as 'http.DefaultServeMux' and since a mux is
a 'http.Handler' you can add it to another mux like this:
myMux.Handle("/debug/", http.DefaultServeMux)
On Sun, Aug 21, 2016 at 10:46 AM, Amit Upadhyay wrote:
> expvar registers expvarHandler as
expvar registers expvarHandler as init(), which registers it to global mux.
This is convenient in general. In my app I have a non global mux, and I
have no way to register it. In case of net/http/pprof the handlers are
exported.
I have ended up copying expvarHandler() in my project.
Should I
Way to go. +KelseyHightower.
Cheers!
--
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
Yes like Jan previously said. It is the very use case WaitGroup was
developed for.
On Sun, Aug 21, 2016, 15:45 T L wrote:
>
>
> On Saturday, August 20, 2016 at 2:29:41 PM UTC+8, Yulrizka wrote:
>>
>> Dear gophers
>>
>> I have discussion with my colleague about this code
>>
I writing a simple HTTP client using the new context support in Go 1.7.
I need to test it in case a timeout is specified and expires, but I'm
having problems.
The context package defines the Cancel error variable, that is returned
by Context.Err when the context is canceled.
However the
On Saturday, August 20, 2016 at 2:29:41 PM UTC+8, Yulrizka wrote:
>
> Dear gophers
>
> I have discussion with my colleague about this code
>
>
> func process() *foo {
> var result *foo
>
> var wg sync.WaitGroup
> wg.Add(1)
> go func() {
> defer wg.Done()
> result
Uh oh. You're right. Thanks for reminding me. Somehow I missed that.
--
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.
Hi,
I think some aspects of Go language are rather verbose to the extent
that they hurts readability. For instance, let's take closures. The
following is a bit hard to read:
func MyFunction(rows *sql.Rows, parser func(raw *sql.Rows) ([]MyData, error
)) ([]MyData,error){
...
}
It would be
Thanks, that worked too!
On Sunday, August 21, 2016 at 1:20:47 AM UTC+1, Aram Hăvărneanu wrote:
>
> You might also be interested in
>
> GOOS=linux GOARCH=arm go build -gcflags='-S' foo
>
> or
>
> GOOS=linux GOARCH=arm go build -gcflags='-S' -asmflags='-S' foo
>
> --
> Aram Hăvărneanu
20 matches
Mail list logo