tools

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package tools provides automatic installation and management of required Go tools

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnknownTool is returned when a tool is not recognized
	ErrUnknownTool = errors.New("unknown tool")
	// ErrInstallFailed is returned when tool installation fails
	ErrInstallFailed = errors.New("tool installation failed")
	// ErrToolNotInPath is returned when a tool is installed but not found in PATH
	ErrToolNotInPath = errors.New("tool installed but not found in PATH")
	// ErrInstallTimeout is returned when tool installation times out
	ErrInstallTimeout = errors.New("tool installation timed out")
)

Error variables for tool installation

Functions

func CleanCache

func CleanCache()

CleanCache clears the installed tools cache

func EnsureInstalled

func EnsureInstalled(ctx context.Context, toolName string) error

EnsureInstalled ensures a tool is installed, installing it if necessary

func GetGoBin

func GetGoBin() string

GetGoBin returns the Go bin directory

func GetGoPath

func GetGoPath() string

GetGoPath returns the GOPATH or default if not set

func GetInstallTimeout added in v1.2.0

func GetInstallTimeout() time.Duration

GetInstallTimeout returns the current tool installation timeout

func GetRetryConfig added in v1.2.0

func GetRetryConfig() (int, time.Duration)

GetRetryConfig returns the current retry configuration

func GetToolPath

func GetToolPath(toolName string) (string, error)

GetToolPath returns the full path to a tool binary

func InstallAllTools

func InstallAllTools(ctx context.Context) error

InstallAllTools installs all required tools

func InstallTool

func InstallTool(ctx context.Context, tool *Tool) error

InstallTool installs a specific tool

func IsInstalled

func IsInstalled(toolName string) bool

IsInstalled checks if a tool is installed and available in PATH

func LoadVersionsFromEnv

func LoadVersionsFromEnv()

LoadVersionsFromEnv loads tool versions from environment variables

func SetInstallTimeout added in v1.2.0

func SetInstallTimeout(timeout time.Duration)

SetInstallTimeout configures the timeout for tool installation

func SetRetryConfig added in v1.2.0

func SetRetryConfig(attempts int, delay time.Duration)

SetRetryConfig configures retry behavior for network operations

Types

type Tool

type Tool struct {
	Name       string
	ImportPath string
	Version    string
	Binary     string
}

Tool represents a Go tool that can be installed

Jump to

Keyboard shortcuts

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