fr
fr

Question from the Go test

Medium

Which code correctly completes the select block to ensure immediate loop interruption upon context cancellation?

func doWork(ctx context.Context) {
    for {
        select {
        // Complétez ici pour gérer l'annulation
        case <-time.After(time.Second):
            doTask()
        }
    }
}
Author: WeLoveDevsStatus: PublishedQuestion not yet passed
Edit
0
Community EvaluationsNo one has reviewed this question yet, be the first!