Documentation
¶
Index ¶
- Constants
- func Semantify(vname string) (*semver.Version, error)
- func WithFinderGoarch(goarch string) func(fdr *Finder)
- func WithFinderGoos(goos string) func(fdr *Finder)
- func WithFinderPackageKind(kind PackageKind) func(fdr *Finder)
- func WithPackages(pkgs []*Package) func(v *Version)
- type Collection
- type Finder
- type Package
- type PackageKind
- type Version
Constants ¶
const Latest = "latest"
Latest represents the current stable release.
Variables ¶
This section is empty.
Functions ¶
func Semantify ¶ added in v1.6.0
Semantify converts Go version strings to semantic version format with adaptation.
func WithFinderGoarch ¶ added in v1.6.0
WithFinderGoarch sets target machine architecture (e.g. 386, amd64, arm, s390x).
func WithFinderGoos ¶ added in v1.6.0
WithFinderGoos sets target operating system (e.g. darwin, freebsd, linux).
func WithFinderPackageKind ¶ added in v1.6.0
func WithFinderPackageKind(kind PackageKind) func(fdr *Finder)
WithFinderPackageKind sets the package kind to search for.
func WithPackages ¶ added in v1.6.0
WithPackages configures available distribution packages for the version.
Types ¶
type Collection ¶ added in v1.6.0
type Collection []*Version
func (Collection) Len ¶ added in v1.6.0
func (c Collection) Len() int
func (Collection) Less ¶ added in v1.6.0
func (c Collection) Less(i, j int) bool
func (Collection) Swap ¶ added in v1.6.0
func (c Collection) Swap(i, j int)
type Finder ¶ added in v1.6.0
type Finder struct {
// contains filtered or unexported fields
}
Finder implements version lookup for Go language distributions.
func NewFinder ¶ added in v1.6.0
NewFinder creates a new Finder instance with sorted versions and applied options.
func (*Finder) Find ¶ added in v1.6.0
Find returns semantic version matching criteria.
Supported patterns: 1. Specific version (e.g. '1.21.4') 2. Latest version identifier 'latest' 3. Wildcards (e.g. '1.21.x', '1.x', '1.18.*') 4. Caret ranges for minor version compatibility (e.g. '^1', '^1.18', '^1.18.10') 5. Tilde ranges for patch version updates (e.g. '~1.18') 6. Greater than comparisons (e.g. '>1.18') 7. Less than comparisons (e.g. '<1.16') 8. Version ranges (e.g. '1.18-1.20')
type Package ¶
type Package struct {
FileName string `json:"filename"`
URL string `json:"url"`
Kind PackageKind `json:"kind"`
OS string `json:"os"`
Arch string `json:"arch"`
Size string `json:"size"`
Checksum string `json:"checksum"`
ChecksumURL string `json:"-"`
Algorithm string `json:"algorithm"` // checksum algorithm
}
Package describes a Go distribution file metadata.
func (*Package) DownloadWithProgress ¶ added in v1.2.0
DownloadWithProgress fetches package with real-time download metrics.
func (*Package) VerifyChecksum ¶
VerifyChecksum validates downloaded file against cryptographic hash.
type PackageKind ¶ added in v1.6.0
type PackageKind string
PackageKind indicates distribution package format type.
const ( // SourceKind indicates source code package SourceKind PackageKind = "Source" // ArchiveKind indicates compressed archive package ArchiveKind PackageKind = "Archive" // InstallerKind indicates executable installer InstallerKind PackageKind = "Installer" )
type Version ¶
type Version struct {
// contains filtered or unexported fields
}
Version represents a Go language distribution version.
func (*Version) FindPackages ¶ added in v1.1.2
func (v *Version) FindPackages(kind PackageKind, goos, goarch string) (pkgs []Package, err error)
FindPackages discovers packages matching specific OS/ARCH and package type.
func (*Version) MatchConstraint ¶ added in v1.6.0
func (v *Version) MatchConstraint(c *semver.Constraints) bool
MatchConstraint checks if version satisfies semantic version constraints.