list

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2020 License: MPL-2.0, MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dir added in v0.1.1

type Dir struct {
	// FilePath is the absolute path to the subject dir.
	FilePath string

	// ImportPath is the path required to import the package in the subject dir.
	ImportPath string

	// ModRootDir is the absolute path to the root dir of the module which includes the subject dir.
	ModRootDir string

	// ModRootImportPath is the path selected in the module's go.mod.
	ModRootImportPath string
}

Dir holds package/module details about a file directory.

func ResolveDir added in v0.1.1

func ResolveDir(ctx context.Context, dir string) (*Dir, error)

ResolveDir returns the module root dir and import path of the input dir.

type Module

type Module struct {
	// Path is an import path.
	Path string

	// Version is a semver string.
	Version string
}

Module holds the per-module fields unmarshaled from "go list" output.

type ModuleSet

type ModuleSet struct {
	// contains filtered or unexported fields
}

ModuleSet holds Module values with unique import paths.

func NewModuleSet

func NewModuleSet() *ModuleSet

NewModuleSet returns an initialized ModuleSet.

func (*ModuleSet) Add

func (l *ModuleSet) Add(m Module) *ModuleSet

Add updates the set, either creating a new entry or overwriting an existing one with the same import path.

func (*ModuleSet) GetByPath

func (l *ModuleSet) GetByPath(p string) *Module

GetByPath returns the Module associated with the input import path, if found. Otherwise it returns nil.

func (*ModuleSet) GetPaths

func (l *ModuleSet) GetPaths() *cage_strings.Set

GetPaths returns all import paths.

type Query

type Query struct {
	// contains filtered or unexported fields
}

Query stores options for, and executes, "go list" in order to produce ModuleSet values.

func NewQuery

func NewQuery(executor cage_exec.Executor, dir string) *Query

NewQuery returns an initialized Query.

func (*Query) AllModules

func (q *Query) AllModules() *Query

AllModules ia an alias for an "-m all" option of "go list".

func (*Query) Modules

func (q *Query) Modules(optVal string) *Query

Modules selects an "-m" option of "go list".

func (*Query) Run

func (q *Query) Run(ctx context.Context) (mods *ModuleSet, err error)

Run executes "go list" with the selected options.

Jump to

Keyboard shortcuts

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