Documentation ¶
Overview ¶
Package goanalysis provides a toolset for statically analysing Go applications
Index ¶
- Variables
- func DiscoverMain(path string) (pkgPaths []string, err error)
- func DiscoverOneMain(path string) (pkgPath string, err error)
- func FindBlankImports(node *ast.File) []string
- func FormatImports(f *ast.File) map[string]string
- func FuncVarExists(f *ast.File, goImport, methodSignature string) bool
- func HasAnyStructFieldsInPkg(pkgPath, structName string, fields []string) (bool, error)
- func ReplaceCode(pkgPath, oldFunctionName, newFunction string) (err error)
- func UpdateInitImports(file *ast.File, writer io.Writer, importsToAdd, importsToRemove []string) error
Constants ¶
This section is empty.
Variables ¶
var ErrMultipleMainPackagesFound = errors.New("multiple main packages found")
ErrMultipleMainPackagesFound is returned when multiple main packages found while expecting only one.
Functions ¶
func DiscoverMain ¶
DiscoverMain finds main Go packages under path.
func DiscoverOneMain ¶
DiscoverOneMain tries to find only one main Go package under path.
func FindBlankImports ¶
FindBlankImports find all blank imports ('_') into a file.
func FormatImports ¶
FormatImports translate f.Imports into a map where name -> package. Name is the alias if declared, or the last element of the package path.
func FuncVarExists ¶
FuncVarExists finds a genesis variable goImport into the go file.
func HasAnyStructFieldsInPkg ¶ added in v28.4.0
HasAnyStructFieldsInPkg finds the struct within a package folder and checks if any of the fields are defined in the struct.
func ReplaceCode ¶ added in v28.2.0
ReplaceCode replace a function implementation into a package path. The method will find the method signature and re-write the method implementation based in the new function.
Types ¶
This section is empty.