toolshonnef.co/go/tools/analysis/facts/typedness Index | Files

package typedness

import "honnef.co/go/tools/analysis/facts/typedness"

Index

Variables

var Analysis = &analysis.Analyzer{
	Name:       "typedness",
	Doc:        "Annotates return values that are always typed values",
	Run:        run,
	Requires:   []*analysis.Analyzer{buildir.Analyzer},
	FactTypes:  []analysis.Fact{(*alwaysTypedFact)(nil)},
	ResultType: reflect.TypeOf((*Result)(nil)),
}

Types

type Result

type Result struct {
	// contains filtered or unexported fields
}

func (*Result) MustReturnTyped

func (r *Result) MustReturnTyped(fn *types.Func, ret int) bool

MustReturnTyped reports whether the ret's return value of fn must be a typed value, i.e. an interface value containing a concrete type or trivially a concrete type. The value of ret is zero-based.

The analysis has false negatives: MustReturnTyped may incorrectly report false, but never incorrectly reports true.

Source Files

typedness.go

Version
v0.6.1 (latest)
Published
Mar 5, 2025
Platform
js/wasm
Imports
9 packages
Last checked
3 hours ago

Tools for package owners.