[GODRIVER-2921] Create a MongoDB Go Driver linter Created: 27/Jul/23  Updated: 12/Jan/24

Status: Backlog
Project: Go Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Unknown
Reporter: Matt Dale Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Create a linter that reports when the MongoDB Go Driver is used in erroneous or error-prone ways. Specifically, cover cases that are detectable by static analysis, but don't cause compilation failures.

Proposed MongoDB Go Driver linter checks:

  1. Check for improper usage of bson.E as a nested document instead of bson.D.
  2. Check for improper passing of multiple options structs to some APIs (only Go Driver 2.x).
  3. Check for un-closed sessions and transactions.
  4. Check for operations inside WithSession or WithTransaction not using the SessionContext.

Definition of done:

  • Create a Go linter that checks for some or all of the proposed problems above.

Open questions:

  • What is the full list of checks?
  • Should we create a new repository or release the linter as a submodule from the Go driver repository?

Generated at Thu Feb 08 08:39:39 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.