如何使用request.Context而不是CloseNotifier?

I am using CloseNotifier in my application, in a code that looks like this

func Handler(res http.ResonseWriter, req *http.Request) {
    notify := res.(CloseNotifier).CloseNotify()

    someLogic();
    select {
        case <-notify:
            someCleanup()
            return;
        default:
    }
    someOtherLogic();
}

I have noticed CloseNotifier is now deprecated. From source code:

// Deprecated: the CloseNotifier interface predates Go's context package.
// New code should use Request.Context instead.

However, I am not sure how to use Request.Context exactly here.

It seems rather simple actually. From this blogpost:

func Handler(res http.ResonseWriter, req *http.Request) {
    ctx := req.Context()

    someLogic();
    select {
        case <-ctx.Done():
            someCleanup(ctx.Err())
            return;
        default:
    }
    someOtherLogic();
}