gotool – github.com/kisielk/gotool Index | Files | Directories

package gotool

import "github.com/kisielk/gotool"

Package gotool contains utility functions used to implement the standard "cmd/go" tool, provided as a convenience to developers who want to write tools with similar semantics.

Index

Variables

var DefaultContext = Context{
	BuildContext: build.Default,
}

DefaultContext is the default context that uses build.Default.

Functions

func ImportPaths

func ImportPaths(args []string) []string

ImportPaths returns the import paths to use for the given command line using default context.

The path "all" is expanded to all packages in $GOPATH and $GOROOT. The path "std" is expanded to all packages in the Go standard library. The path "cmd" is expanded to all Go standard commands. The string "..." is treated as a wildcard within a path. When matching recursively, directories are ignored if they are prefixed with a dot or an underscore (such as ".foo" or "_foo"), or are named "testdata". Relative import paths are not converted to full import paths. If args is empty, a single element "." is returned.

Types

type Context

type Context struct {
	// BuildContext is the build.Context that is used when computing import paths.
	BuildContext build.Context
}

A Context specifies the supporting context.

func (*Context) ImportPaths

func (c *Context) ImportPaths(args []string) []string

ImportPaths returns the import paths to use for the given command line.

The path "all" is expanded to all packages in $GOPATH and $GOROOT. The path "std" is expanded to all packages in the Go standard library. The path "cmd" is expanded to all Go standard commands. The string "..." is treated as a wildcard within a path. When matching recursively, directories are ignored if they are prefixed with a dot or an underscore (such as ".foo" or "_foo"), or are named "testdata". Relative import paths are not converted to full import paths. If args is empty, a single element "." is returned.

Source Files

match.go tool.go

Directories

PathSynopsis
internal
Version
v1.0.0 (latest)
Published
Feb 21, 2018
Platform
linux/amd64
Imports
3 packages
Last checked
10 seconds ago

Tools for package owners.