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.30.0 (latest)
Published
Feb 10, 2025
Platform
linux/amd64
Imports
6 packages
Last checked
6 hours ago

Tools for package owners.