Skip to content

Files

Latest commit

 

History

History
22 lines (13 loc) · 656 Bytes

context-as-argument.md

File metadata and controls

22 lines (13 loc) · 656 Bytes

Pattern: Inconsistent context.Context usage as parameter

Issue: -

Description

By convention, context.Context should be the first parameter of a function. This rule spots function declarations that do not follow the convention.

Configuration

  • allowTypesBefore : (string) comma-separated list of types that may be before 'context.Context'

Example:

[rule.context-as-argument]
  arguments = [{allowTypesBefore = "*testing.T,*github.com/user/repo/testing.Harness"}]

Further Reading