fillreturns

package
v0.16.2 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2024 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Overview

Package fillreturns defines an Analyzer that will attempt to automatically fill in a return statement that has missing values with zero value elements.

Analyzer fillreturns

fillreturns: suggest fixes for errors due to an incorrect number of return values

This checker provides suggested fixes for type errors of the type "wrong number of return values (want %d, got %d)". For example:

func m() (int, string, *bool, error) {
	return
}

will turn into

func m() (int, string, *bool, error) {
	return 0, "", nil, nil
}

This functionality is similar to https://github.com/sqs/goreturns.

Index

Constants

This section is empty.

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name:             "fillreturns",
	Doc:              analysisinternal.MustExtractDoc(doc, "fillreturns"),
	Run:              run,
	RunDespiteErrors: true,
	URL:              "https://pkg.go.dev/golang.org/x/tools/gopls/internal/analysis/fillreturns",
}

Functions

func FixesError

func FixesError(err types.Error) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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