Mongodb-go-driver context with Cursor.Close, Session.EndSession

Hi,

I noticed that the mongodb-go-driver accepts a context for the Cursor.Close, Session.EndSession, transaction, etc. This looks like a problem to me, as context is used for cancellation and cancelling a close operation is not really desired (Leaking the cursor).

I can try just passing context.Background() specifically to such close methods, but that seems very error prone.

You would often use context by taking the HTTP request context, which gets cancelled if the connection is severed for any reason, and possibly add a Mongo session on top of it if desired (UseSession). If I then just pass context.Background(), it won’t use the session for those close operations which I’m not sure is correct or even going to work.

Any ideas?