- says "The length and capacity of a nil slice, map, or channel are 0.".
However, it seems to work - http://play.golang.org/p/N-BtX758Hn (included
below for ease of read, too):
package main
import "fmt"
func main() {
c := make(chan int, 2)
fmt.Println("cap", cap(c))
fmt.Println("len", len(c))
c <- 1
c <- 2
fmt.Println("len", len(c))
fmt.Println(<-c)
fmt.Println(<-c)
fmt.Println("len", len(c))
}
So, which one here is it? :-)
1) I misunderstand the spec.
2) The spec is wrong.
3) The implementation is doing more than promised and it might go away.
4) Something I didn't think of.
This came up as a "sidebar" on
stackoverflow: http://stackoverflow.com/questions/15858658/do-go-channels-preserve-order-when-blocked
Ask
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.