A file finder written in Go for my needs.
Uses a worker pool to search through directory trees quicker and take advantage of multi-core machines. Go concurrency allows it to run on single core machines.
If you're looking for something specific you can limit the number of responses
- Concurrency which may speed up or slow down the search depending on the tree structure.
- Common paths are ignored to save time and checks, such as
node_modules
,.git
, and pythonvenv
. - Searches for a pattern using basic sub-string
warning Does not work on windows and I'm not trying too support this
- user cobra for for a better cli experience
- sub command to print paths that are ignored
- create case sensative/insensative searching
- exclude additional directories or patters
- include specific patterns in the search path
- switch to ignore all hidden files/directories
- can we create a worker pool instead of the number of initial directories
- cap the number of returned responses, say 1 (quit after the first match!)
- Auto-generate releases
- cap the depth of the search
- use select statement with a fallback queue to prevent deadlock from happening
build with go build -o gf main.go
and run with ./gf -d <starting-path> -p <pattern-to-match-on>
- Go 1.21+
You can use the makefile to build a production release with make build
- Make
- Go 1.21+
Customise your search with the following flags
Usage of ./gf:
-c int
The maximum number of results to find (default -1)
-d string
The starting directory to check for files (default ".")
-p string
A pattern to check for within the file names
-q int
The max work queue size (default 2048)
-w int
Number of workers (default 8)