____ ___ ____ _____ _ ____ ____ _ _ / ___|/ _ \/ ___|| ____| / \ | _ \ / ___| | | | | | _| | | \___ \| _| / _ \ | |_) | | | |_| | | |_| | |_| |___) | |___ / ___ \| _ <| |___| _ | \____|\___/|____/|_____/_/ \_\_| \_\\____|_| |_|
A blazing-fast, concurrent code search tool built in Go
Search codebases in milliseconds | Respects .gitignore | Zero dependencies
|
|
|
|
# Install directly with Go (recommended)
go install github.com/vennictus/gosearch@latest
# Or clone and build
git clone https://github.com/vennictus/gosearch.git
cd gosearch && go build -o gosearch .Requirements: Go 1.21 or higher
# Search for "TODO" in current directory
gosearch "TODO" .
# Case-insensitive search
gosearch -i "error" ./src
# Find function definitions with regex
gosearch -regex "func\s+\w+\(" .
# Search only Go files
gosearch -extensions .go "panic" .
# Get JSON output for tooling
gosearch -format json "config" . | jq '.matches'
# Just count matches
gosearch -count "FIXME" .| Category | Flag | Description | Example |
|---|---|---|---|
| Search Mode | -i |
Case-insensitive matching | gosearch -i "Error" . |
-w |
Match whole words only | gosearch -w "log" . |
|
-regex |
Treat pattern as regex | gosearch -regex "v[0-9]+" . |
|
| Filtering | -extensions |
Only search these extensions | -extensions .go,.ts |
-exclude-dir |
Skip directories by name | -exclude-dir vendor,node_modules |
|
-max-size |
Skip files larger than size | -max-size 1MB |
|
-max-depth |
Limit directory depth | -max-depth 3 |
|
| Output | -format |
Output format (plain/json) | -format json |
-color |
Highlight matches | -color |
|
-count |
Only print match count | -count |
|
-quiet |
No output, exit code only | -quiet |
|
| Performance | -workers |
Number of search workers | -workers 8 |
-dynamic-workers |
Auto-scale worker count | -dynamic-workers |
|
-metrics |
Show performance stats | -metrics |
| Code | Meaning | Use Case |
|---|---|---|
| 0 | Matches found | Success — pattern was found |
| 1 | No matches | Pattern not found (not an error) |
| 2 | Error | Invalid args, bad regex, etc. |
Perfect for scripting:
if gosearch -quiet "TODO" .; then
echo "Found TODOs!"
figosearch uses a 4-stage concurrent pipeline:
┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Traversal │───>│ IO Workers │───>│ CPU Workers │───>│ Printer │
│ (walker) │ │ (file read) │ │ (search) │ │ (output) │
└─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘
Benchmarks (searching 10,000 files):
BenchmarkSmallFiles-8 1000 1.2ms/op 0 allocs/op
BenchmarkLargeFiles-8 100 12.4ms/op 0 allocs/op
Create .gosearchrc in your project root:
{
"ignore_case": true,
"format": "json",
"extensions": [".go", ".ts", ".js"],
"exclude_dirs": ["vendor", "node_modules", ".git"]
}Create .gosearchignore (same syntax as .gitignore):
# Skip generated files
*.generated.go
*_gen.go
# Skip test fixtures
testdata/
fixtures/# Bash
gosearch -completion bash > ~/.local/share/bash-completion/completions/gosearch
# Zsh
gosearch -completion zsh > ~/.zfunc/_gosearch
# Fish
gosearch -completion fish > ~/.config/fish/completions/gosearch.fish
# PowerShell
gosearch -completion powershell >> $PROFILEgosearch/
├── main.go # Entry point & pipeline orchestration
├── internal/
│ ├── config/ # CLI parsing, validation, config loading
│ ├── search/ # Matcher, workers, file traversal
│ ├── ignore/ # .gitignore & .gosearchignore parsing
│ └── output/ # Result formatting (plain, JSON, color)
├── completions/ # Shell completion scripts
├── testdata/ # Test fixtures (unicode, edge cases, code samples)
└── scripts/ # Build & release automation
| Document | Description |
|---|---|
| GUIDE.md | Deep-dive tutorial for beginners — explains every concept from scratch |
| PRODUCT_SPEC.md | Full technical specification and design documentation |
# Run all tests
go test ./...
# Run with race detector
go test -race ./...
# Run benchmarks
go test -bench=. -benchmem ./...
# Build for current platform
go build -o gosearch .MIT License — see LICENSE for details.
Built with Go