gotool

package
v0.9.12 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Download goDownload = runGoDownload

Download runs `go download` and provides optionals for adding command line arguments.

View Source
var Get goGet = runGoGet

Get runs `go get` and provides optionals for adding command line arguments.

View Source
var Install goInstall = runGoInstall

Install runs `go install` and provides optionals for adding command line arguments.

View Source
var Licenser goLicenser = runGoLicenser

Licenser runs `go-licenser` and provides optionals for adding command line arguments.

View Source
var Mod = goMod{
	Download: modCommand{"download"}.run,
	Init:     modCommand{"init"}.run,
	Tidy:     modCommand{"tidy"}.run,
	Verify:   modCommand{"verify"}.run,
	Vendor:   modCommand{"vendor"}.run,
}

Mod is the command go mod.

View Source
var NoticeGenerator goNoticeGenerator = runGoNoticeGenerator

NoticeGenerator runs `go-license-detector` and provides optionals for adding command line arguments.

View Source
var Test goTest = runGoTest

Test runs `go test` and provides optionals for adding command line arguments.

Functions

func GetModuleName

func GetModuleName() (string, error)

GetModuleName returns the name of the module.

func HasTests

func HasTests(pkg string) (bool, error)

HasTests returns true if the given package contains test files.

func ListDeps

func ListDeps(pkg string) ([]string, error)

ListDeps calls `go list -dep` for every package spec given.

func ListDepsForNotice

func ListDepsForNotice() (string, error)

func ListDepsLocation

func ListDepsLocation(pkg string) (map[string]string, error)

ListDepsLocation calls `go list -dep` for every package spec given.

func ListModuleCacheDir

func ListModuleCacheDir(pkg string) (string, error)

ListModuleCacheDir returns the module cache directory containing the specified module. If the module does not exist in the cache, an error will be returned.

func ListModuleVendorDir

func ListModuleVendorDir(pkg string) (string, error)

ListModuleVendorDir returns the vendor directory containing the specified module. If the module has not been vendored, an error will be returned.

func ListPackages

func ListPackages(pkgs ...string) ([]string, error)

ListPackages calls `go list` for every package spec given.

func ListProjectPackages

func ListProjectPackages() ([]string, error)

ListProjectPackages lists all packages in the current project

func ListTestFiles

func ListTestFiles(pkg string) ([]string, error)

ListTestFiles lists all go and cgo test files available in a package.

Types

type ArgOpt

type ArgOpt func(args *Args)

ArgOpt is a functional option adding info to Args once executed.

type Args

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

Args holds parameters, environment variables and flag information used to pass to the go tool.

func (*Args) Add

func (a *Args) Add(p string)

Add adds a positional argument to be passed to the child process on exec.

func (*Args) Env

func (a *Args) Env(k, v string)

Env sets an environmant variable to be passed to the child process on exec.

func (*Args) Extra

func (a *Args) Extra(k, v string)

Extra sets a special k/v pair to be interpreted by the execution function.

func (*Args) Flag

func (a *Args) Flag(flag, value string)

Flag adds a flag to be passed to the child process on exec.

func (*Args) Val

func (a *Args) Val(k string) string

Val returns a special functions value for a given key.

Jump to

Keyboard shortcuts

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