348032 (2) [Avatar] Offline
Having a hard time understanding the following declaration on the Runner code:

19 // complete channel reports that processing is done.
20 complete chan error
22 // timeout reports that time has run out.
23 timeout <-chan time.Time”

is error a keyword? What about the second statement? Is it saying it is buffered channel?

Thanks in advance.
Bill Kennedy (69) [Avatar] Offline
These are declarations in the struct type. They are not initialized that this point, just declaring the Runner type.

complete chan error

This is declaring a field named complete that is of type chan error.
error is the error interface type

timeout <-chan time.Time

This is declaring a field named timeout that is of type chan time.Time.
The arrow is specifying that the channel is read only.
348032 (2) [Avatar] Offline
Thanks got it. I don't think I saw that declaration in previous examples, previous examples used declare and assign using "make". I don't think I saw "<-" as readonly on previous examples either. I apologize ahead of time if I missed.

Thanks again,
pires (4) [Avatar] Offline
I had the exact same doubt while crossing this piece of code, but had to find my way in #go-nuts @ irc.freenode.net. Btw, perhaps a reference to that channel would be a plus?
Bill Kennedy (69) [Avatar] Offline