analysisutil

Imports

Imports #

"bytes"
"go/ast"
"go/printer"
"go/token"
"go/types"
"os"
"golang.org/x/tools/go/analysis"
"golang.org/x/tools/internal/analysisinternal"

Constants & Variables

MustExtractDoc var #

var MustExtractDoc = analysisinternal.MustExtractDoc

Functions

Format function #

Format returns a string representation of the expression.

func Format(fset *token.FileSet, x ast.Expr) string

HasSideEffects function #

HasSideEffects reports whether evaluation of e has side effects.

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

Imports function #

Imports returns true if path is imported by pkg.

func Imports(pkg *types.Package, path string) bool

IsFunctionNamed function #

IsFunctionNamed reports whether f is a top-level function defined in the given package and has one of the given names. It returns false if f is nil or a method.

func IsFunctionNamed(f *types.Func, pkgPath string, names ...string) bool

IsNamedType function #

IsNamedType reports whether t is the named type with the given package path and one of the given names. This function avoids allocating the concatenation of "pkg.Name", which is important for the performance of syntax matching.

func IsNamedType(t types.Type, pkgPath string, names ...string) bool

LineStart function #

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 LineStart(f *token.File, line int) token.Pos

ReadFile function #

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

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

Generated with Arrow