fr
fr

Question from the Go test

Waiting for validation

Which statements are true? (multiple answers)

func fetch(ctx context.Context, i int) error {
	return fmt.Errorf("error from goroutine %d", i)
}

func main() {
	g, _ := errgroup.WithContext(context.Background())

	for i := range 1000 {
		g.Go(func() error {
			return fetch(context.Background(), i)
		})
	}

	err := g.Wait()
	if err != nil {
		fmt.Println(err)
	}
}
Author: John PendenqueStatus: Waiting for validationQuestion not yet passed
0
Community EvaluationsNo one has reviewed this question yet, be the first!