gocmd

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2019 License: MPL-2.0 Imports: 4 Imported by: 2

Documentation

Overview

Package gocmd provides functions for working with the Go tool. This package is not named "go" because that name collides with a reserved keyword.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Name

func Name(importPath string) string

Name computes the vendored import path of a package given its fully qualified import name.

Types

type Go

type Go struct {
	Cmd string
	Dir string
}

Go contains configuration information for the Go tool.

func (*Go) Build

func (g *Go) Build(pkgs []string) error

Build runs `go build` for packages.

func (*Go) Clean

func (g *Go) Clean(pkgs []string) error

Clean runs `go clean` for packages.

func (*Go) List

func (g *Go) List(pkgs, flags []string) ([]Package, error)

List runs `go list` to return information about packages.

func (*Go) ListOne

func (g *Go) ListOne(pkg string, flags []string) (Package, error)

ListOne runs List for a single package.

type GoListOutput

type GoListOutput struct {
	Name       string
	ImportPath string
	Dir        string
	Standard   bool
	Imports    []string
	Deps       []string
	Error      *GoListPackageError
	DepsErrors []*GoListPackageError
}

GoListOutput is a subset of the output of `go list`. See `go help list` for details.

type GoListPackageError

type GoListPackageError struct {
	ImportStack []string
	Pos         string
	Err         string
}

GoListPackageError is the PackageError struct defined in `go help list`.

type Package

type Package struct {
	Name       string      // Vendored import name (what would go into an `import` statement).
	ImportPath string      // Fully qualified import name (including `vendor` folders).
	Dir        string      // Absolute location on filesystem.
	IsInternal bool        // Whether the package is an internal package.
	IsStdLib   bool        // Whether the package is a part of the standard library.
	Imports    []string    // Direct dependencies.
	Deps       []string    // Transitive dependencies.
	Error      interface{} // A package loading error, if applicable.
}

Package represents a single Go package.

Jump to

Keyboard shortcuts

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