package analysisutil

import "golang.org/x/tools/go/analysis/passes/internal/analysisutil"

Package analysisutil defines various helper functions used by two or more packages beneath go/analysis.

Index

Variables

var MustExtractDoc = analysisinternal.MustExtractDoc

Functions

func HasSideEffects

func HasSideEffects(info *types.Info, e ast.Expr) bool

HasSideEffects reports whether evaluation of e has side effects.

func LineStart

func LineStart(f *token.File, line int) token.Pos

LineStart returns the position of the start of the specified line within file f, or NoPos if there is no line of that number.

func ReadFile

func ReadFile(pass *analysis.Pass, filename string) ([]byte, *token.File, error)

ReadFile reads a file and adds it to the FileSet so that we can report errors against it using lineStart.

Source Files

util.go

Version
v0.32.0 (latest)
Published
Apr 8, 2025
Platform
darwin/amd64
Imports
6 packages
Last checked
14 minutes ago

Tools for package owners.