A little confused by the test case of `singleflight` of 
`internal/singleflight`.

Which is the codes singleflight 
<https://github.com/golang/go/blob/master/src/internal/singleflight/singleflight_test.go#L43>
.

1. wg1 

Purpose for wg1 is as commented as: 

// At least one goroutine is in fn now and all of them have at
// least reached the line before the Do.

Confused about `At least one goroutine is in fn `,what test situation for 
this?
I mean, for example, if 'no one goroutine is in fn', would be any problem?

2. the channel `c`

Each `fn` just read from `c`, and write value back, as codes:

v := <-c
c <- v // pump; make available for any future calls

Don't really get the purpose.

3. got value
The expect value of got is: 0<got<N.

Why not 0<got<=N, I mean there is case got==N?

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/54d0186e-ac0c-4518-a187-68736037fb1bn%40googlegroups.com.

Reply via email to