Skip to content

A suggestion about Usage and documentation #15

Description

@fzxbl

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)) 
      }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions