errlast

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 errlast provides a go/analysis analyzer enforcing the gomatic Go idiom that error is always the last return value.

The analyzer checks only results typed as the builtin error interface type, including aliases of it (e.g. type E = error). Concrete error-implementing types (func f() (*MyErr, int)) and error-constrained type parameters (func f[E error]() (E, int)) are deliberately out of scope: returning a concrete error type is its own smell, not this analyzer's rule.

Index

Constants

This section is empty.

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name:     "errlast",
	Doc:      "reports error return values that are not last",
	Requires: []*analysis.Analyzer{inspect.Analyzer},
	Run:      run,
}

Analyzer reports error results that are not the last return value.

View Source
var Registration = goyze.Registration{
	Name:       "errlast",
	Categories: []goyze.Category{"errors"},
	URL:        "https://docs.gomatic.dev/yze/errlast",
	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-errlast command
Command yze-go-errlast runs the errlast analyzer as a standalone go/analysis checker (text and -json output, and as a `go vet -vettool`).
Command yze-go-errlast runs the errlast 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