mirror of
https://github.com/tw93/Mole.git
synced 2026-03-22 23:40:09 +00:00
All files in cmd/analyze/ are macOS-only but several were missing the //go:build darwin constraint. On Linux (e.g. CodeQL CI), Go compiled these files without the types defined in main.go (which had the tag), causing undefined symbol errors for dirEntry, fileEntry, scanResult, cacheEntry, historyEntry and model. - Add //go:build darwin to heap.go, cache.go, scanner.go, cleanable.go, delete.go, format.go, constants.go and all *_test.go files Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
265 lines
6.4 KiB
Go
265 lines
6.4 KiB
Go
//go:build darwin
|
|
|
|
package main
|
|
|
|
import "time"
|
|
|
|
const (
|
|
maxEntries = 30
|
|
maxLargeFiles = 20
|
|
barWidth = 24
|
|
spotlightMinFileSize = 100 << 20
|
|
largeFileWarmupMinSize = 1 << 20
|
|
defaultViewport = 12
|
|
overviewCacheTTL = 7 * 24 * time.Hour
|
|
overviewCacheFile = "overview_sizes.json"
|
|
duTimeout = 30 * time.Second
|
|
mdlsTimeout = 5 * time.Second
|
|
maxConcurrentOverview = 8
|
|
batchUpdateSize = 100
|
|
cacheModTimeGrace = 30 * time.Minute
|
|
cacheReuseWindow = 24 * time.Hour
|
|
staleCacheTTL = 3 * 24 * time.Hour
|
|
|
|
// Worker pool limits.
|
|
minWorkers = 16
|
|
maxWorkers = 64
|
|
cpuMultiplier = 4
|
|
maxDirWorkers = 32
|
|
openCommandTimeout = 10 * time.Second
|
|
)
|
|
|
|
var foldDirs = map[string]bool{
|
|
// VCS.
|
|
".git": true,
|
|
".svn": true,
|
|
".hg": true,
|
|
|
|
// JavaScript/Node.
|
|
"node_modules": true,
|
|
".npm": true,
|
|
"_npx": true,
|
|
"_cacache": true,
|
|
"_logs": true,
|
|
"_locks": true,
|
|
"_quick": true,
|
|
"_libvips": true,
|
|
"_prebuilds": true,
|
|
"_update-notifier-last-checked": true,
|
|
".yarn": true,
|
|
".pnpm-store": true,
|
|
".next": true,
|
|
".nuxt": true,
|
|
"bower_components": true,
|
|
".vite": true,
|
|
".turbo": true,
|
|
".parcel-cache": true,
|
|
".nx": true,
|
|
".rush": true,
|
|
"tnpm": true,
|
|
".tnpm": true,
|
|
".bun": true,
|
|
".deno": true,
|
|
|
|
// Python.
|
|
"__pycache__": true,
|
|
".pytest_cache": true,
|
|
".mypy_cache": true,
|
|
".ruff_cache": true,
|
|
"venv": true,
|
|
".venv": true,
|
|
"virtualenv": true,
|
|
".tox": true,
|
|
"site-packages": true,
|
|
".eggs": true,
|
|
"*.egg-info": true,
|
|
".pyenv": true,
|
|
".poetry": true,
|
|
".pip": true,
|
|
".pipx": true,
|
|
|
|
// Ruby/Go/PHP (vendor), Java/Kotlin/Scala/Rust (target).
|
|
"vendor": true,
|
|
".bundle": true,
|
|
"gems": true,
|
|
".rbenv": true,
|
|
"target": true,
|
|
".gradle": true,
|
|
".m2": true,
|
|
".ivy2": true,
|
|
"out": true,
|
|
"pkg": true,
|
|
"composer.phar": true,
|
|
".composer": true,
|
|
".cargo": true,
|
|
|
|
// Build outputs.
|
|
"build": true,
|
|
"dist": true,
|
|
".output": true,
|
|
"coverage": true,
|
|
".coverage": true,
|
|
|
|
// IDE.
|
|
".idea": true,
|
|
".vscode": true,
|
|
".vs": true,
|
|
".fleet": true,
|
|
|
|
// Cache directories.
|
|
".cache": true,
|
|
"__MACOSX": true,
|
|
".DS_Store": true,
|
|
".Trash": true,
|
|
"Caches": true,
|
|
".Spotlight-V100": true,
|
|
".fseventsd": true,
|
|
".DocumentRevisions-V100": true,
|
|
".TemporaryItems": true,
|
|
"$RECYCLE.BIN": true,
|
|
".temp": true,
|
|
".tmp": true,
|
|
"_temp": true,
|
|
"_tmp": true,
|
|
".Homebrew": true,
|
|
".rustup": true,
|
|
".sdkman": true,
|
|
".nvm": true,
|
|
|
|
// macOS.
|
|
"Application Scripts": true,
|
|
"Saved Application State": true,
|
|
|
|
// iCloud.
|
|
"Mobile Documents": true,
|
|
|
|
// Containers.
|
|
".docker": true,
|
|
".containerd": true,
|
|
|
|
// Mobile development.
|
|
"Pods": true,
|
|
"DerivedData": true,
|
|
".build": true,
|
|
"xcuserdata": true,
|
|
"Carthage": true,
|
|
".dart_tool": true,
|
|
|
|
// Web frameworks.
|
|
".angular": true,
|
|
".svelte-kit": true,
|
|
".astro": true,
|
|
".solid": true,
|
|
|
|
// Databases.
|
|
".mysql": true,
|
|
".postgres": true,
|
|
"mongodb": true,
|
|
|
|
// Other.
|
|
".terraform": true,
|
|
".vagrant": true,
|
|
"tmp": true,
|
|
"temp": true,
|
|
}
|
|
|
|
var skipSystemDirs = map[string]bool{
|
|
"dev": true,
|
|
"tmp": true,
|
|
"private": true,
|
|
"cores": true,
|
|
"net": true,
|
|
"home": true,
|
|
"System": true,
|
|
"sbin": true,
|
|
"bin": true,
|
|
"etc": true,
|
|
"var": true,
|
|
"opt": false,
|
|
"usr": false,
|
|
"Volumes": true,
|
|
"Network": true,
|
|
".vol": true,
|
|
".Spotlight-V100": true,
|
|
".fseventsd": true,
|
|
".DocumentRevisions-V100": true,
|
|
".TemporaryItems": true,
|
|
".MobileBackups": true,
|
|
}
|
|
|
|
var defaultSkipDirs = map[string]bool{
|
|
"nfs": true,
|
|
"PHD": true,
|
|
"Permissions": true,
|
|
|
|
// Virtualization/Container mounts (NFS, network filesystems).
|
|
"OrbStack": true, // OrbStack NFS mounts
|
|
"Colima": true, // Colima VM mounts
|
|
"Parallels": true, // Parallels Desktop VMs
|
|
"VMware Fusion": true, // VMware Fusion VMs
|
|
"VirtualBox VMs": true, // VirtualBox VMs
|
|
"Rancher Desktop": true, // Rancher Desktop mounts
|
|
".lima": true, // Lima VM mounts
|
|
".colima": true, // Colima config/mounts
|
|
".orbstack": true, // OrbStack config/mounts
|
|
}
|
|
|
|
var skipExtensions = map[string]bool{
|
|
".go": true,
|
|
".js": true,
|
|
".ts": true,
|
|
".tsx": true,
|
|
".jsx": true,
|
|
".json": true,
|
|
".md": true,
|
|
".txt": true,
|
|
".yml": true,
|
|
".yaml": true,
|
|
".xml": true,
|
|
".html": true,
|
|
".css": true,
|
|
".scss": true,
|
|
".sass": true,
|
|
".less": true,
|
|
".py": true,
|
|
".rb": true,
|
|
".java": true,
|
|
".kt": true,
|
|
".rs": true,
|
|
".swift": true,
|
|
".m": true,
|
|
".mm": true,
|
|
".c": true,
|
|
".cpp": true,
|
|
".h": true,
|
|
".hpp": true,
|
|
".cs": true,
|
|
".sql": true,
|
|
".db": true,
|
|
".lock": true,
|
|
".gradle": true,
|
|
".mjs": true,
|
|
".cjs": true,
|
|
".coffee": true,
|
|
".dart": true,
|
|
".svelte": true,
|
|
".vue": true,
|
|
".nim": true,
|
|
".hx": true,
|
|
}
|
|
|
|
var spinnerFrames = []string{"|", "/", "-", "\\", "|", "/", "-", "\\"}
|
|
|
|
const (
|
|
colorPurple = "\033[0;35m"
|
|
colorPurpleBold = "\033[1;35m"
|
|
colorGray = "\033[0;90m"
|
|
colorRed = "\033[0;31m"
|
|
colorYellow = "\033[0;33m"
|
|
colorGreen = "\033[0;32m"
|
|
colorBlue = "\033[0;34m"
|
|
colorCyan = "\033[0;36m"
|
|
colorReset = "\033[0m"
|
|
colorBold = "\033[1m"
|
|
)
|