-
Type: Improvement
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: None
-
None
-
Needed
We currently document in the Go Driver Code Example Reference that examples should always use variable name "ctx" for the callback function signatures when using the mongo.WithSession and Session.WithTransaction functions.
The reason for that guideline is that it helps prevent a common error of using the outer context (i.e. the one from outside the callback func that doesn't contain the session/transaction information) instead of the inner context from the callback func. Naming the variable "ctx" shadows the context from outside the callback func, preventing that error (assuming users are using the common "ctx" context variable name).
However, the Go Driver code, Godocs, and example code still uses the "sessCtx" variable name. Update all "sessCtx" variable names to "ctx" to match the Go Driver Code Example Reference doc.