goanalysis

package
v0.27.2 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package goanalysis provides a toolset for statically analysing Go applications

Index

Constants

This section is empty.

Variables

View Source
var ErrMultipleMainPackagesFound = errors.New("multiple main packages found")

ErrMultipleMainPackagesFound is returned when multiple main packages found while expecting only one.

Functions

func DiscoverMain

func DiscoverMain(path string) (pkgPaths []string, err error)

DiscoverMain finds main Go packages under path.

func DiscoverOneMain

func DiscoverOneMain(path string) (pkgPath string, err error)

DiscoverOneMain tries to find only one main Go package under path.

func FormatImports added in v0.25.0

func FormatImports(f *ast.File) map[string]string

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 added in v0.27.0

func FuncVarExists(f *ast.File, goImport, methodSignature string) bool

FuncVarExists finds a genesis variable goImport into the go file.

func UpdateInitImports added in v0.27.0

func UpdateInitImports(file *ast.File, writer io.Writer, importsToAdd, importsToRemove []string) error

UpdateInitImports helper function to remove and add underscore (init) imports to an *ast.File.

Types

This section is empty.

Jump to

Keyboard shortcuts

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