fr
fr

Question from the Go test

Medium

Identify the critical error in context management within this function.

func fetchData(ctx context.Context) error {
	ctx, _ = context.WithTimeout(ctx, 2*time.Second)

	select {
	case <-time.After(1 * time.Second):
		return nil
	case <-ctx.Done():
		return ctx.Err()
	}
}
Author: WeLoveDevsStatus: PublishedQuestion not yet passed
Edit
0
Community EvaluationsNo one has reviewed this question yet, be the first!