gotool

package
v2.0.12 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2018 License: MIT, MIT Imports: 3 Imported by: 0

Documentation

Overview

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

Constants

This section is empty.

Variables

View Source
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.

Directories

Path Synopsis
internal
load
Package load loads packages.
Package load loads packages.

Jump to

Keyboard shortcuts

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