pool
pool copied to clipboard
A suggestion about Usage and documentation
In the Batch Work example,The email.Value will be nil when called batch.Cancel() that will cause Panic as a result of wrong type desertation
for email := range batch.Results() {
if err := email.Error(); err != nil {
// handle error
// maybe call batch.Cancel()
}
// use return value
// The email.Value will be nil when called batch.Cancel() that will cause Panic as a result of wrong type desertation
fmt.Println(email.Value().(bool))
}
It might be good to write like this
for email := range batch.Results() {
if err := email.Error(); err != nil {
// handle error
// maybe call batch.Cancel()
}else{
// use return value
fmt.Println(email.Value().(bool))
}