Gofis is a lightweight, high-performance command-line utility built in Go for searching files across your system. It leverages Go's native concurrency model to walk directory trees rapidly, making it significantly faster than traditional single-threaded search tools.
- Concurrent Searching: Uses a configurable pool of goroutines to scan multiple directories simultaneously.
- Smart Filtering: Search by partial filenames, specific extensions, or both.
- Automatic Ignoring: Defaults to skip heavy folders like
enode_modules,.git, andvendorto save time. - Human-Readable Output: Displays file sizes in a formatted, easy-to-read way (KB, MB, GB, etc.).
- Flexible Interface: Supports both traditional flags and shorthand positional arguments.
Ensure you have Go installed on your machine.
git clone https://github.com/yourusername/gofis.git
cd gofis
go build -o gofis main.goGofis provides two ways to search: using flags or using positional arguments.
./gofis -n "config" -e ".yaml" -p ./src./gofis "filename" "searchPath" [maxGoroutines]Example: ./gofis "main" "./projects" 50
By default, Gofis skips common metadata and dependency folders to increase speed ("node_modules,.git,.svn,vendor"). You can override this using the -i flag.
- To customize the list:
./gofis -n "main" -i "dist,temp,logs"- To disable the ignore list (Search ALL directories): Pass an empty string to the ignore flag.
./gofis -n "target_file" -i ""🔍 Regex Filename Search
Gofis treats the search term as a Regular Expression (case-insensitive by default). This allows for much more powerful queries than simple string matching.
.\gofis.exe "^.*\.ini$" "D:\"Note: When using special characters like |, , or ( ) in your terminal, remember to wrap your search term in quotes (e.g., "^data_.").
Gofis uses a Semaphore Pattern to manage system resources. While it spawns a new goroutine for every subdirectory it encounters, it limits the number of active operations using a buffered channel (sem). This prevents the application from hitting "too many open files" errors or overwhelming the CPU.
- WaitGroup: Ensures the main process doesn't exit until all sub-directories have been fully scanned.
- Channels: Streams results back to the main thread in real-time, allowing you to see matches immediately without waiting for the entire scan to finish.
This project is open-source and available under the MIT License.
