Help us shape the future of Go! Take the 2026 Go Developer Survey

astutil

package
v0.79.8 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package astutil provides shared AST/type helper functions used by linters.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Inspector added in v0.79.4

func Inspector(pass *analysis.Pass) (*inspector.Inspector, error)

Inspector extracts the *inspector.Inspector from pass.ResultOf. It returns an error if the result has an unexpected type.

func IsFmtErrorf

func IsFmtErrorf(pass *analysis.Pass, call *ast.CallExpr) bool

IsFmtErrorf reports whether call is a call to fmt.Errorf (including aliases).

func IsLocalObject

func IsLocalObject(obj types.Object) bool

IsLocalObject reports whether obj is a local (non-package-scope) object.

func IsStringLiteral

func IsStringLiteral(expr ast.Expr) bool

IsStringLiteral reports whether expr is a string literal.

func NodeText added in v0.79.4

func NodeText(fset *token.FileSet, node ast.Node) string

NodeText formats node as Go source text using go/printer.

func RhsExprForIndex

func RhsExprForIndex(rhs []ast.Expr, idx int) (ast.Expr, bool)

RhsExprForIndex returns the RHS expression mapped to idx when available. When rhs has a single expression, only idx==0 is considered mapped.

Types

This section is empty.

Jump to

Keyboard shortcuts

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