Reading https://go.dev/ref/spec#Comparison_operators , I come across the interesting but a little ambiguous definition of equality of channels:
*"Channel types are comparable. Two channel values areequal if they were created by the same call to make orif both have value nil." (emphasis mine)* I tried the simplest/obvious (to me) interpretation that "the same make" meant textually the same file and line number. But no, it appears not: https://go.dev/play/p/NUWkWckEQvM *package mainimport "fmt"func main() { a := make(chan bool) // created by the make of line 22 b := make(chan bool) // created by the make of line 23 fmt.Printf(" is a == b ? %v \n", a == b) // false. "makes" sense (ha!), as line 22 != line 23. var slc []chan bool for i := range 3 { slc = append(slc, make(chan bool)) // all three are created by the make of line 29. if i > 0 { fmt.Printf("is slc[%v] == slc[0] ? %v \n", i, slc[i] == slc[0]) // always says false, even though all 3 were from "the same make", that of line 29. } }}* *Output:* * is a == b ? false is slc[1] == slc[0] ? false is slc[2] == slc[0] ? false * *So what is "the same make"?* -- 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 visit https://groups.google.com/d/msgid/golang-nuts/cd609136-cb6d-4156-8a41-1edf538a11bfn%40googlegroups.com.