deps

package
v1.43.2 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2025 License: Apache-2.0 Imports: 19 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareVersions added in v1.42.2

func CompareVersions(installed, required string, mode VersionCheckMode) (bool, error)

CompareVersions compares two version strings using semver

func ExtractVersionFromOutput added in v1.42.2

func ExtractVersionFromOutput(output, pattern string) (string, error)

ExtractVersionFromOutput extracts version using regex pattern

func GetInstalledVersion added in v1.42.2

func GetInstalledVersion(binaryPath string, dependency *Dependency) (string, error)

GetInstalledVersion extracts version from binary output

func GetInstalledVersionByCommand added in v1.42.2

func GetInstalledVersionByCommand(command string, dependency *Dependency) (string, error)

GetInstalledVersionByCommand extracts version by running command directly

func Install added in v1.42.2

func Install(name, version string, opts ...InstallOption) error

Install installs a dependency with configurable options

func InstallDependencies

func InstallDependencies(deps map[string]string, binDir string) error

InstallDependencies takes a map of supported dependencies and their version and installs them to the specified binDir

func InstallDependency

func InstallDependency(name, ver string, binDir string) error

InstallDependency installs a binary to binDir, if ver is nil then the default version is used

func Which added in v1.3.0

func Which(cmd string) bool

Types

type BinaryFunc

type BinaryFunc func(msg string, args ...any) error

BinaryFunc is an interface to executing a binary, downloading it necessary

func Binary

func Binary(name, ver string, binDir string) BinaryFunc

Binary returns a function that can be called to execute the binary

func BinaryWithEnv

func BinaryWithEnv(name, ver string, binDir string, env map[string]string) BinaryFunc

BinaryWithEnv returns a function that be called to execute the binary

func BinaryWithOptions added in v1.42.2

func BinaryWithOptions(name, ver string, opts ...InstallOption) BinaryFunc

BinaryWithOptions returns a function that can be called to execute the binary with configurable options

type BinaryFuncWithEnv

type BinaryFuncWithEnv func(msg string, env map[string]string, args ...any) error

BinaryFuncWithEnv is an interface to executing a binary, downloading it necessary

type Dependency

type Dependency struct {
	Version        string
	Linux          string
	LinuxARM       string
	Macosx         string
	MacosxARM      string
	Windows        string
	Go             string
	Docker         string
	Template       string
	BinaryName     string
	PreInstalled   []string
	VersionCommand string            // Command to get version (e.g., "--version")
	VersionPattern string            // Regex pattern to extract version from output
	Checksums      map[string]string // Platform -> checksum mapping
}

Dependency is a struct referring to a version and the templated path to download the dependency on the different OS platforms

func (*Dependency) GetPath added in v1.5.15

func (dependency *Dependency) GetPath(name string, binDir string) (string, error)

func (*Dependency) GetPathWithOptions added in v1.42.2

func (dependency *Dependency) GetPathWithOptions(name string, binDir string, goos, goarch string) (string, error)

GetPathWithOptions returns the binary path using specified OS and architecture

type InstallOption added in v1.42.2

type InstallOption func(*InstallOptions)

InstallOption is a functional option for configuring installation

func WithBinDir added in v1.42.2

func WithBinDir(dir string) InstallOption

WithBinDir sets the binary installation directory

func WithForce added in v1.42.2

func WithForce(force bool) InstallOption

WithForce enables or disables forced reinstallation

func WithOS added in v1.42.2

func WithOS(goos, goarch string) InstallOption

WithOS overrides the target OS and architecture

func WithPreferLocal added in v1.42.2

func WithPreferLocal(prefer bool) InstallOption

WithPreferLocal prefers locally installed binaries over downloading

func WithSkipChecksum added in v1.42.2

func WithSkipChecksum(skip bool) InstallOption

WithSkipChecksum enables or disables checksum verification

func WithTimeout added in v1.42.2

func WithTimeout(timeout time.Duration) InstallOption

WithTimeout sets the download timeout

func WithVersionCheck added in v1.42.2

func WithVersionCheck(mode VersionCheckMode) InstallOption

WithVersionCheck sets the version checking mode

type InstallOptions added in v1.42.2

type InstallOptions struct {
	BinDir       string
	Force        bool
	VersionCheck VersionCheckMode
	GOOS         string
	GOARCH       string
	Timeout      time.Duration
	SkipChecksum bool
	PreferLocal  bool
}

InstallOptions configures the installation behavior

type Process added in v1.42.2

type Process struct {
	Process *osExec.Cmd
}

func (Process) Exec added in v1.42.2

func (p Process) Exec(args ...any) error

type VersionCheckMode added in v1.42.2

type VersionCheckMode int

VersionCheckMode defines how version checking should be performed

const (
	// VersionCheckNone skips version checking entirely
	VersionCheckNone VersionCheckMode = iota
	// VersionCheckExact requires an exact version match
	VersionCheckExact
	// VersionCheckMinimum requires the installed version to be at least the specified version
	VersionCheckMinimum
	// VersionCheckCompatible allows compatible versions (same major version)
	VersionCheckCompatible
)

Jump to

Keyboard shortcuts

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