Documentation
¶
Overview ¶
Package filekind holds only the "file name → kind" rule data and query primitives: multi-segment extensions, archive/executable/installer suffix sets and the release asset classification.
It deliberately holds no decision policy: it does not build extractors, touch the file system, or decide platform/match semantics. Every exported set is named after its consuming site and keeps that site's original suffix list and case axis unchanged — migration equivalence is a hard requirement, see docs/plans/2026-10-17-rule-consolidation-plan.md.
Index ¶
- Constants
- Variables
- func ExecutableSuffixExact(name string) string
- func ExecutableSuffixFold(name string) string
- func IsArchiveFold(name string, set []string) bool
- func IsDownloadFold(name string) bool
- func IsExecutableExact(name string) bool
- func IsExecutableFold(name string) bool
- func IsInstallerFold(name string) bool
- func IsNonExecutableExact(name string) bool
- func MultiExtExact(name string, set []string) (string, bool)
- func MultiExtFold(name string, set []string) string
- func RequiresSystemArchiverFold(name string) bool
- type AssetClass
- type Kind
Constants ¶
const ( ExtExe = ".exe" ExtAppImage = ".appimage" ExtMsi = ".msi" )
Single suffixes that several stations compare against after taking them from a set; exporting them keeps the literal in one place.
Variables ¶
var ( // ExtSetExtractor is the suffix list of install.NewExtractor. ExtSetExtractor = []string{ ".tar.gz", ".tgz", ".tar.bz2", ".tbz", ".tar.xz", ".txz", ".tar.zst", ".tar", ".zip", ".7z", ".gz", ".bz2", ".xz", ".zst", } // ExtSetExtractAll is the suffix list of install.isExtractAllArchiveAsset // (archives only, no single-file compressors). ExtSetExtractAll = []string{ ".zip", ".7z", ".tar", ".tar.gz", ".tgz", ".tar.bz2", ".tbz", ".tar.xz", ".txz", ".tar.zst", } // ExtSetArchiveMulti is the multi-segment archive list shared by // client.archiveExt, app/cache.cacheAssetExt and the sdk index parsers. ExtSetArchiveMulti = []string{ ".tar.gz", ".tar.xz", ".tar.bz2", ".tar.zst", ".tar.br", ".tar.lz4", } // ExtSetDownload is the suffix list of install.isInvalidCachedDownload. ExtSetDownload = []string{".zip", ".gz", ".tgz", ".xz", ".bz2", ".zst", ".7z", ".rar"} // ExtSetSystemArchiver is the unconditional set of // install.shouldUseSystem7z; the ".exe" case is conditional and stays at the // call site as IsExecutableFold(name) && extractArchive. ExtSetSystemArchiver = []string{".7z", ".rar", ".msi", ".cab", ".iso"} // ExtSetNonExecutable is the suffix list of install.isDefinitelyNotExec. // The base-name list (license/readme/...) stays in that function. ExtSetNonExecutable = []string{".deb", ".1", ".txt"} // ExtSetExecutable is the executable suffix list used with either case axis. ExtSetExecutable = []string{ExtExe, ExtAppImage} // ExtSetInstaller is the installer suffix list of install.DetectGUIInstallMode // and DetectInstallerKind. ExtSetInstaller = []string{ExtExe, ExtMsi} )
Named suffix sets. Each set mirrors the sites that consume it: never merge two sets that differ in content, because the sites differ in intent (ExtSetExtractor carries the single-file compressors, ExtSetArchiveMulti only the multi-segment archives).
Functions ¶
func ExecutableSuffixExact ¶
ExecutableSuffixExact returns the executable suffix of name using the case-sensitive axis (install.rename, install.executableSuffix callers that keep the caller's case), or an empty string.
func ExecutableSuffixFold ¶
ExecutableSuffixFold returns the executable suffix of the folded name, or an empty string — the mapping used by install.heuristicExecutableName and normalizedAssetNameHint.
func IsArchiveFold ¶
IsArchiveFold reports whether the folded name ends with a suffix of set.
func IsDownloadFold ¶
IsDownloadFold reports whether the folded extension of name (a file system path, as consumed by install.isInvalidCachedDownload) is a downloadable archive entry.
func IsExecutableExact ¶
IsExecutableExact reports whether name ends with an executable suffix, using the case-sensitive comparison of install.rename, BinaryChooser.Choose and isExec.
func IsExecutableFold ¶
IsExecutableFold reports whether the folded name ends with an executable suffix (install.isExecutableForGOOS, autoSelectOnlyWindowsExecutable, requiresSystem7z, shouldUseSystem7z).
func IsInstallerFold ¶
IsInstallerFold reports whether the folded name ends with an installer suffix (install.DetectGUIInstallMode, DetectInstallerKind). Keyword checks such as "setup"/"installer" stay in the callers.
func IsNonExecutableExact ¶
IsNonExecutableExact reports whether name ends with a suffix that is never executable (install.isDefinitelyNotExec). Its base-name list stays in the caller.
func MultiExtExact ¶
MultiExtExact returns the extension of name for the multi-segment set, matching case-sensitively. On a match it returns the set literal, e.g. ".tar.gz"; callers trim the leading dot to get the sdk-style value. Without a match it returns path.Ext(name) and false.
func MultiExtFold ¶
MultiExtFold returns the extension of name for the multi-segment set, matching case-insensitively and returning the slice of the original input (so its case is preserved) — the exact behaviour of client.archiveExt and app/cache.cacheAssetExt. Without a match it falls back to path.Ext.
func RequiresSystemArchiverFold ¶
RequiresSystemArchiverFold reports whether the folded name must be handled by the system archiver: the unconditional suffixes of ExtSetSystemArchiver only. The conditional ".exe" case is expressed by the callers as IsExecutableFold(name) && extractArchive.
Types ¶
type AssetClass ¶
type AssetClass int
AssetClass is the release asset classification result.
const ( AssetInstallable AssetClass = iota AssetChecksum AssetSignature AssetMetadata )
Release asset classes.
func ClassifyAsset ¶
func ClassifyAsset(asset string) AssetClass
ClassifyAsset classifies a release asset by base name, lower-cased first, in the original order of install/detect.classifyReleaseAsset: metadata, checksum, signature, then installable.
type Kind ¶
type Kind int
Kind is the intermediate "file name → archive/compression kind" result. The caller maps it to a concrete extractor; the mapping stays in package install because the constructors live there.