Comment Comment by dumbo-octopus One could theoretically pull out the shared boilerplate to a utility function like: func runTask[T any](task func() (T, error)) chan result[T] { ch := make(chan result[T]) go func() { defer close(ch) res, err := task() ch <- result[T]{ el:res, err:err } }() return ch } Does that sort of thing happen much in practice? parent dumbo-octopus 2 years ago