ctxfirst

package module
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 30, 2026 License: MIT Imports: 6 Imported by: 0

README

yze-go-ctxfirst

A yze analyzer (category patterns) enforcing the gomatic Go idiom that a context.Context parameter is always the first parameter. The convention is a contract on any signature taking a context.Context, so it is checked on function and method declarations, interface method signatures, function literals, and function-typed definitions alike.

  • Rule: yze/ctxfirst
  • Library: exports Analyzer and Registration for the yze aggregator and stickler runner.
  • Binary: cmd/yze-go-ctxfirst runs it standalone (text/-json, and as a go vet -vettool).

Built on the go-yze framework.

Documentation

Overview

Package ctxfirst provides a go/analysis analyzer enforcing the gomatic Go idiom that a context.Context parameter is always the first parameter.

Index

Constants

This section is empty.

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name:     "ctxfirst",
	Doc:      "reports context.Context parameters that are not the first parameter",
	Requires: []*analysis.Analyzer{inspect.Analyzer},
	Run:      run,
}

Analyzer reports context.Context parameters that are not first.

View Source
var Registration = goyze.Registration{
	Name:       "ctxfirst",
	Categories: []goyze.Category{"patterns"},
	URL:        "https://docs.gomatic.dev/yze/ctxfirst",
	Analyzer:   Analyzer,
}

Registration declares this analyzer to the yze framework.

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis
cmd
yze-go-ctxfirst command
Command yze-go-ctxfirst runs the ctxfirst analyzer as a standalone go/analysis checker (text and -json output, and as a `go vet -vettool`).
Command yze-go-ctxfirst runs the ctxfirst analyzer as a standalone go/analysis checker (text and -json output, and as a `go vet -vettool`).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL