goload

package
v0.0.0-...-c39e8e5 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2022 License: AGPL-3.0 Imports: 12 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListPkgs

func ListPkgs(p string) ([]string, error)

ListPkgs list all packages under a package path.

func ListStdPkgs

func ListStdPkgs() []string

ListStdPkgs returns a list of all packages in the golang standard library with the specific GOPATH.

func MakeContext

func MakeContext(gopath string) *build.Context

MakeContext makes a build context for the given GOPATH.

Types

type Package

type Package struct {
	Build     *build.Package
	ImportMap map[string]string // import remapping due to vendoring

	ModRoot    string // module root import path, not including version
	ModVerRoot string // module root import path, including version
	ModVerPath string // alias import path when module is enabled
}

Package is a package in the scan result.

type Program

type Program struct {
	*loader.Program

	Pkgs []string
}

Program is a loaded program from a set of packages.

func LoadPkg

func LoadPkg(pkgs ...string) (*Program, error)

LoadPkg loads a set of pacakges from source files into a loader program. It just calls LoadPkgs with the parameter list

func LoadPkgs

func LoadPkgs(pkgs []string) (*Program, error)

LoadPkgs loads a list of package from source files into a loader program.

type ScanOptions

type ScanOptions struct {
	Context *build.Context

	// TestdataWhiteList provides a whitelist of "testdata" packages that are
	// valid ones and being imported.
	TestdataWhiteList map[string]bool

	// PkgBlackList is a list of packages that will be skipped. It will also
	// skip its sub packages.
	PkgBlackList map[string]bool
}

ScanOptions provides the options for scanning a Go language repository.

type ScanResult

type ScanResult struct {
	Repo        string
	Pkgs        map[string]*Package
	HasVendor   bool
	HasInternal bool
	Warnings    []error
}

ScanResult has the scanning result

func ScanModPkgs

func ScanModPkgs(mod, dir string, opts *ScanOptions) (*ScanResult, error)

ScanModPkgs scans all packages in a module.

func ScanPkgs

func ScanPkgs(p string, opts *ScanOptions) (*ScanResult, error)

ScanPkgs scans all packages under a package path.

Jump to

Keyboard shortcuts

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