undeclaredname

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: 14 Imported by: 0

Documentation

Overview

Package undeclaredname defines an Analyzer that applies suggested fixes to errors of the type "undeclared name: %s".

Analyzer undeclaredname

undeclaredname: suggested fixes for "undeclared name: <>"

This checker provides suggested fixes for type errors of the type "undeclared name: <>". It will either insert a new statement, such as:

<> :=

or a new function declaration, such as:

func <>(inferred parameters) {
	panic("implement me!")
}

Index

Constants

View Source
const FixCategory = "undeclaredname" // recognized by gopls ApplyFix

Variables

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

Functions

func SuggestedFix

func SuggestedFix(fset *token.FileSet, start, end token.Pos, content []byte, file *ast.File, pkg *types.Package, info *types.Info) (*token.FileSet, *analysis.SuggestedFix, error)

SuggestedFix computes the edits for the lazy (no-edits) fix suggested by the analyzer.

Types

This section is empty.

Jump to

Keyboard shortcuts

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