Documentation ¶
Overview ¶
Package toolbox is a library for automating tool dependency management. It is designed as the logical portion of the toolbox binary.
Toolbox uses a file (default "tools.go") to manage its dependency list. This is should always be a .go file, as version information is tracked via go modules, and thus tool dependencies need to be kept in a file that the go module system can scan. The tools themselves are kept in a folder (default "_tools").
Toolbox doesn't do anything massively unique, it simply automates the fiddly bits...it implements the best practices for tool automation found here: https://github.com/go-modules-by-example/index/blob/master/010_tools/README.md
Index ¶
- func Add(packageName string, options ...Option) error
- func AddVer(packageName, version string, options ...Option) error
- func Command(command string, args ...string) (*exec.Cmd, error)
- func CommandOpts(command string, args []string, options ...Option) (*exec.Cmd, error)
- func Do(command ...string) error
- func DoOpts(command []string, options ...Option) error
- func Remove(packageName string, options ...Option) error
- func Sync(options ...Option) error
- type Logger
- type Option
- func BasedirOption(basedirName string) Option
- func BuildFlagsOption(buildFlags string) Option
- func GoOption(goBinaryName string) Option
- func GoimportsOption(goimportsBinaryName string) Option
- func LoggerOption(logger Logger) Option
- func ToolsdirOption(toolsdirName string) Option
- func ToolsfileOption(toolsfileName string) Option
- type Tool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddVer ¶
AddVer adds a new tool found at packageName with a specific version to the vendoring system
func Command ¶
Command creates an exec.Cmd, modifying the environment and run binary name to reflect the vendored tools.
func CommandOpts ¶
CommandOpts creates an exec.Cmd, modifying the environment and run binary name to reflect the vendored tools, using the given options.
Types ¶
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option is an optional modifier to toolbox's default behavior
func BasedirOption ¶
BasedirOption changes the directory when using the default toolsfile and directory
func BuildFlagsOption ¶
BuildFlagsOption passes flags to go get and go install
func GoimportsOption ¶
GoimportsOption changes the default name/path of the "goimports" binary.
func LoggerOption ¶
Logger option passes a logger to capture output from the subcommands
func ToolsdirOption ¶
TooldirOption changes the default name/path of the directory used to vendor tools
func ToolsfileOption ¶
ToolfileOption changes the default name/path of the file used to manage tool dependencies