ctxfirst

package module
v0.2.7 Latest Latest
Warning

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

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

README

Documentation

Overview

Package ctxfirst provides a go/analysis analyzer enforcing the gomatic Go idiom that context.Context parameters form a contiguous leading prefix of the positional parameter list. Parameters are judged by position, not by field spelling — (a, b context.Context) and (a context.Context, b context.Context) are identical — and any context.Context parameter that follows a non-context parameter is reported.

Index

Constants

This section is empty.

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name:     "ctxfirst",
	Doc:      "reports context.Context parameters that do not form a leading prefix of the parameter list",
	Requires: []*analysis.Analyzer{inspect.Analyzer},
	Run:      run,
}

Analyzer reports context.Context parameters that follow a non-context parameter.

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