importalias

package
v1.33.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(pkgPaths []string, verbose bool, w io.Writer) error

Types

type AliasStatus

type AliasStatus struct {
	// true if this alias is the only alias used for a package or is the most common alias used for a package.
	OK bool
	// recommendation for how to fix the issue if OK is false.
	Recommendation string
}

type ProjectImportInfo

type ProjectImportInfo interface {
	// AddImportAliasesFromFile adds all of the import alias information from the given file.
	AddImportAliasesFromFile(filename string) error

	// ImportsWithMultipleAliases returns a map from an imported package path to all of the aliases to import the package.
	// The aliases are sorted by the number of uses of that alias.
	ImportsToAliases() map[string][]aliasInfo

	// FilesToImportAliases returns a map from each file in the project to all of the alias imports in the file.
	FilesToImportAliases() map[string][]singleAlias

	// GetAliasStatus returns the AliasStatus for the given alias used to import the package with the provided path.
	GetAliasStatus(alias, importPath string) AliasStatus
}

func NewProjectImportInfo

func NewProjectImportInfo() ProjectImportInfo

Jump to

Keyboard shortcuts

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