Skip to content

Results clipped after first error with .WithErrors() #156

@zoido

Description

@zoido

When the Result Pool is configured WithErrors results after fir error are clipped.

Minimal Example

package main

import (
	"errors"
	"fmt"

	"github.com/sourcegraph/conc/pool"
)

func main() {
	p := pool.NewWithResults[int]().WithErrors()
	p.Go(func() (int, error) { return 1, nil })
	p.Go(func() (int, error) { return 2, errors.New("an error") })
	p.Go(func() (int, error) { return 3, nil })

	got, _ := p.Wait()
	fmt.Println(got) // Outputs [1]
}

Expected output: [1 3]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions