3 ms·
Channels require concurrency; you have to spin up another goroutine and take care not to let or deadlock. Channels are for communication between goroutines, not
by weberc2 9y ago
Channels require concurrency; you have to spin up another goroutine and take care not to let or deadlock. Channels are for communication between goroutines, not for general abstraction.
- hnlmorg 9y agoI agree. Callbacks makes sense in this context and is the idiomatic way to write the code given that's the approach used in the standard library. eg: https://golang.org/pkg/path/filepath/#Walk https://golang.org/pkg/path/filepath/#Walk https://golang.org/pkg/net/http/#HandleFunc https://golang.org/pkg/net/http/#HandleFunc
- weberc2 9y ago*Take care not to leak or deadlock