Documentation
¶
Index ¶
Constants ¶
const ( // CacheFileName is the name of the platform cache file CacheFileName = "platforms.json" // CacheTTL is how long cached platform info is considered valid CacheTTL = 24 * time.Hour )
const ( // HomebrewVersionURL is the URL to Homebrew's macOS version definitions HomebrewVersionURL = "https://raw.githubusercontent.com/Homebrew/brew/master/Library/Homebrew/macos_version.rb" // MinSupportedMacOSMajor is the minimum macOS version we generate bottles for // Apple supports ~3 years of macOS versions MinSupportedMacOSMajor = 12 // Monterey )
Variables ¶
This section is empty.
Functions ¶
func FormatPlatformList ¶
func FormatPlatformList(info *PlatformInfo) string
FormatPlatformList returns a human-readable list of platforms
func ParsePlatformTag ¶
ParsePlatformTag parses a Homebrew platform tag into OS, arch, and version
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache manages platform information caching
func (*Cache) Load ¶
func (c *Cache) Load() (*PlatformInfo, error)
Load loads platform info from cache if valid and not expired
func (*Cache) LoadExpired ¶
func (c *Cache) LoadExpired() (*PlatformInfo, error)
LoadExpired loads platform info from cache even if expired
func (*Cache) Save ¶
func (c *Cache) Save(info *PlatformInfo) error
Save saves platform info to cache
type CachedPlatformInfo ¶
type CachedPlatformInfo struct {
PlatformInfo
CachedAt time.Time `json:"cached_at"`
}
CachedPlatformInfo wraps PlatformInfo with cache metadata
type Discoverer ¶
type Discoverer struct {
// contains filtered or unexported fields
}
Discoverer fetches current platform information from Homebrew's source
func NewDiscoverer ¶
func NewDiscoverer(cacheDir string) (*Discoverer, error)
NewDiscoverer creates a new platform discoverer
func (*Discoverer) Discover ¶
func (d *Discoverer) Discover(ctx context.Context, forceRefresh bool) (*PlatformInfo, error)
Discover fetches current supported platforms from Homebrew If forceRefresh is false, returns cached data if available and not expired
func (*Discoverer) GetPlatformsForArtifact ¶
func (d *Discoverer) GetPlatformsForArtifact(ctx context.Context, goos, goarch string, forceRefresh bool) ([]Platform, error)
GetPlatformsForArtifact returns all Homebrew platforms compatible with a GOOS/GOARCH
type MacOSVersion ¶
MacOSVersion represents a macOS version with its codename
func (MacOSVersion) String ¶
func (v MacOSVersion) String() string
type Platform ¶
type Platform struct {
Tag string // e.g., "arm64_sonoma", "x86_64_linux"
OS string // "darwin" or "linux"
Arch string // "amd64" or "arm64"
OSVersion string // e.g., "sonoma", "ventura" (macOS codename), or empty for Linux
OSVersionMajor int // e.g., 14 for sonoma; 0 for Linux
}
Platform represents a Homebrew bottle platform tag
func FilterPlatforms ¶
FilterPlatforms filters platforms based on include/exclude lists
type PlatformInfo ¶
type PlatformInfo struct {
MacOSVersions []MacOSVersion // Supported macOS versions (newest first)
LinuxArches []string // e.g., ["x86_64", "aarch64"]
}
PlatformInfo holds discovered platform information
func DefaultPlatformInfo ¶
func DefaultPlatformInfo() *PlatformInfo
DefaultPlatformInfo returns a fallback platform info if discovery fails. Only includes macOS versions currently supported by Apple/Homebrew (past 3 releases).
func (*PlatformInfo) AllPlatforms ¶
func (pi *PlatformInfo) AllPlatforms() []Platform
AllPlatforms returns all possible platform tags
func (*PlatformInfo) GetPlatformsForOS ¶
func (pi *PlatformInfo) GetPlatformsForOS(goos, goarch string) []Platform
GetPlatformsForOS returns the Homebrew platform tag for a given OS/arch. For macOS, returns only the oldest supported version (e.g., monterey). Homebrew's fallback mechanism allows older bottles to install on newer macOS.