install

package
v0.0.0-...-6867f40 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InstallError

type InstallError struct {
	Type    InstallErrorType
	Phase   InstallPhase
	Message string
	Err     error
}

InstallError represents a structured installation error

func (*InstallError) Error

func (e *InstallError) Error() string

Error implements the error interface

func (*InstallError) Unwrap

func (e *InstallError) Unwrap() error

Unwrap implements error unwrapping

type InstallErrorType

type InstallErrorType string

InstallErrorType categorizes installation errors

const (
	ErrorTypeFetch            InstallErrorType = "fetch"
	ErrorTypeNotFound         InstallErrorType = "not_found"
	ErrorTypeAlreadyInstalled InstallErrorType = "already_installed"
	ErrorTypeDownload         InstallErrorType = "download"
	ErrorTypeExtract          InstallErrorType = "extract"
	ErrorTypeVerification     InstallErrorType = "verification"
	ErrorTypeChecksum         InstallErrorType = "checksum"
	ErrorTypeNotInstalled     InstallErrorType = "not_installed"
	ErrorTypePlatform         InstallErrorType = "platform"
)

type InstallPhase

type InstallPhase string

InstallPhase represents the current phase of installation

const (
	PhaseFetching    InstallPhase = "fetching"
	PhaseValidating  InstallPhase = "validating"
	PhaseDownloading InstallPhase = "downloading"
	PhaseExtracting  InstallPhase = "extracting"
	PhaseVerifying   InstallPhase = "verifying"
	PhaseComplete    InstallPhase = "complete"
)

type Installer

type Installer struct {
	Verbose       bool
	Quiet         bool
	KeepBuildPath bool
	MirrorURL     string
	// contains filtered or unexported fields
}

Installer handles Go installation

func NewInstaller

func NewInstaller(cfg *config.Config) *Installer

NewInstaller creates a new installer

func (*Installer) DownloadWithRetry

func (i *Installer) DownloadWithRetry(url, expectedSHA256, filename string, retryConfig RetryConfig) (string, error)

DownloadWithRetry downloads a file with retry logic and optional resume

func (*Installer) Install

func (i *Installer) Install(goVersion string, force bool) error

Install installs a specific Go version

func (*Installer) Uninstall

func (i *Installer) Uninstall(goVersion string) error

Uninstall removes a Go version

type RetryConfig

type RetryConfig struct {
	MaxRetries       int           // Maximum number of retry attempts
	InitialDelay     time.Duration // Initial delay before first retry
	MaxDelay         time.Duration // Maximum delay between retries
	Timeout          time.Duration // Overall timeout for download
	EnableResume     bool          // Whether to use HTTP Range for resume
	InteractiveRetry bool          // Whether to prompt user for retry
}

RetryConfig holds configuration for download retries

func DefaultRetryConfig

func DefaultRetryConfig() RetryConfig

DefaultRetryConfig returns the default retry configuration

Jump to

Keyboard shortcuts

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