go-fd
A pure-Go port of fd — a simple, fast and
user-friendly alternative to find. It provides both a CLI tool (fd) that
mirrors the original's interface and a Go SDK for programmatic use.
Features
- Intuitive syntax —
fd PATTERNinstead offind -iname '*PATTERN*'. - Regex (default) and glob matching (
-g/--glob). - Fast, parallel directory traversal using goroutines.
- Smart case — case-insensitive unless the pattern has an uppercase char.
- Respects ignore files —
.gitignore,.ignore,.fdignore, global and custom ignore files, with nested-directory support. - Hidden-file handling, exclusion globs (
-E), and directory pruning. - Rich filters — by type (
-t), extension (-e), size (-S), modification time (--changed-within/--changed-before) and owner (-o, unix). - Command execution — run a command per result (
-x) or batched (-X). - Output control — colors (LS_COLORS),
--formattemplates,--print0, hyperlinks, custom path separators, depth and result limits. - NPM distribution — install via npm/yarn for Node.js projects.
- Pure Go SDK — embed fd-style search in your own programs.
Installation
From source
git clone https://github.com/startvibecoding/go-fd.git
cd go-fd
make build # produces ./bin/fd
Via go install
go install github.com/startvibecoding/go-fd/cmd/fd@latest
As a Go library
go get github.com/startvibecoding/go-fd@latest
Then import the module root. The import path contains go-fd, but the package
name is gofd:
import gofd "github.com/startvibecoding/go-fd"
Via the install script
curl -fsSL https://raw.githubusercontent.com/startvibecoding/go-fd/main/install.sh | bash
# Install to a custom directory:
curl -fsSL https://raw.githubusercontent.com/startvibecoding/go-fd/main/install.sh | bash -s -- -d ~/.local/bin
# Uninstall:
curl -fsSL https://raw.githubusercontent.com/startvibecoding/go-fd/main/install.sh | bash -s -- --uninstall
Via npm
The npm package ships a small launcher plus per-platform binary packages
(optionalDependencies), so you only download the binary for your platform.
npm install -g @startvibecoding/go-fd-installer
# Binary available as `fd`
Pre-built binaries
Download a .tar.gz (Linux/macOS/FreeBSD) or .zip (Windows) from the
GitHub Releases page.
Supported platforms
go-fd is pure Go and builds for a broad OS/architecture matrix. Pre-built binaries and npm packages are published for:
| OS | Architectures |
|---|---|
| Linux (glibc) | amd64, arm64, arm (v7), 386, loong64, riscv64, ppc64le, s390x |
| Linux (musl, static) | amd64, arm64 |
| macOS | amd64 (Intel), arm64 (Apple Silicon) |
| Windows | amd64, arm64, 386 |
| FreeBSD | amd64, arm64 |
The source additionally compiles for other Go targets (NetBSD, OpenBSD,
DragonFly, illumos/Solaris, Android, and more) — run make build-<os> or set
GOOS/GOARCH directly.
CLI usage
# Find entries matching a regex (filename only, by default)
fd netfl
# Match all files with a given extension
fd -e go
# Glob search
fd -g '*.txt'
# Search hidden + ignored files
fd -u pattern
# Filter by type and size, in a specific path
fd -t f -S +1m '\.log
Run fd --help for the full option list.
SDK usage
The module root exposes a friendly API in package gofd.
package main
import (
"context"
"fmt"
gofd "github.com/startvibecoding/go-fd"
)
func main() {
// Collect all matching paths.
paths, err := gofd.Find(context.Background(), gofd.Options{
Pattern: `\.gogo-fd
A pure-Go port of __INLINE_CODE_0__ — a simple, fast and
user-friendly alternative to __INLINE_CODE_1__. It provides both a CLI tool (__INLINE_CODE_2__) that
mirrors the original's interface and a Go SDK for programmatic use.
Features
- Intuitive syntax — __INLINE_CODE_3__ instead of __INLINE_CODE_4__.
- Regex (default) and glob matching (__INLINE_CODE_5__).
- Fast, parallel directory traversal using goroutines.
- Smart case — case-insensitive unless the pattern has an uppercase char.
- Respects ignore files — __INLINE_CODE_6__, __INLINE_CODE_7__, __INLINE_CODE_8__, global and
custom ignore files, with nested-directory support.
- Hidden-file handling, exclusion globs (__INLINE_CODE_9__), and directory pruning.
- Rich filters — by type (__INLINE_CODE_10__), extension (__INLINE_CODE_11__), size (__INLINE_CODE_12__), modification
time (__INLINE_CODE_13__/__INLINE_CODE_14__) and owner (__INLINE_CODE_15__, unix).
- Command execution — run a command per result (__INLINE_CODE_16__) or batched (__INLINE_CODE_17__).
- Output control — colors (LS_COLORS), __INLINE_CODE_18__ templates, __INLINE_CODE_19__,
hyperlinks, custom path separators, depth and result limits.
- NPM distribution — install via npm/yarn for Node.js projects.
- Pure Go SDK — embed fd-style search in your own programs.
Installation
From source
git clone https://github.com/startvibecoding/go-fd.git
cd go-fd
make build # produces ./bin/fd
Via __INLINE_CODE_20__
go install github.com/startvibecoding/go-fd/cmd/fd@latest
As a Go library
go get github.com/startvibecoding/go-fd@latest
Then import the module root. The import path contains __INLINE_CODE_21__, but the package
name is __INLINE_CODE_22__:
import gofd "github.com/startvibecoding/go-fd"
Via the install script
curl -fsSL https://raw.githubusercontent.com/startvibecoding/go-fd/main/install.sh | bash
# Install to a custom directory:
curl -fsSL https://raw.githubusercontent.com/startvibecoding/go-fd/main/install.sh | bash -s -- -d ~/.local/bin
# Uninstall:
curl -fsSL https://raw.githubusercontent.com/startvibecoding/go-fd/main/install.sh | bash -s -- --uninstall
Via npm
The npm package ships a small launcher plus per-platform binary packages
(__INLINE_CODE_23__), so you only download the binary for your platform.
npm install -g @startvibecoding/go-fd-installer
# Binary available as `fd`
Pre-built binaries
Download a __INLINE_CODE_24__ (Linux/macOS/FreeBSD) or __INLINE_CODE_25__ (Windows) from the
GitHub Releases page.
Supported platforms
go-fd is pure Go and builds for a broad OS/architecture matrix. Pre-built
binaries and npm packages are published for:
OS
Architectures
Linux (glibc)
amd64, arm64, arm (v7), 386, loong64, riscv64, ppc64le, s390x
Linux (musl, static)
amd64, arm64
macOS
amd64 (Intel), arm64 (Apple Silicon)
Windows
amd64, arm64, 386
FreeBSD
amd64, arm64
The source additionally compiles for other Go targets (NetBSD, OpenBSD,
DragonFly, illumos/Solaris, Android, and more) — run __INLINE_CODE_26__ or set
__INLINE_CODE_27__/__INLINE_CODE_28__ directly.
CLI usage
# Find entries matching a regex (filename only, by default)
fd netfl
# Match all files with a given extension
fd -e go
# Glob search
fd -g '*.txt'
# Search hidden + ignored files
fd -u pattern
# Filter by type and size, in a specific path
fd -t f -S +1m '\.log
Run __INLINE_CODE_29__ for the full option list.
SDK usage
The module root exposes a friendly API in package __INLINE_CODE_30__.
,
Paths: []string{"."},
Hidden: false,
})
if err != nil {
panic(err)
}
for _, p := range paths {
fmt.Println(p)
}
// Or stream results as they are discovered.
results, errs, err := gofd.Stream(context.Background(), gofd.Options{
Pattern: "main",
Glob: false,
Paths: []string{"."},
})
if err != nil {
panic(err)
}
for r := range results {
fmt.Println("found:", r.Path)
}
for range errs {
// non-fatal traversal errors
}
}
gofd.Options
The Options struct exposes the same knobs as the CLI: pattern interpretation
(Glob, FixedStrings, Exact), case handling (CaseSensitive,
IgnoreCase), ignore handling (Hidden, NoIgnore, Unrestricted, ...),
traversal (MaxDepth, MinDepth, FollowLinks, Prune, Threads), filters
(Types, Extensions, Sizes, ChangedWithin, ChangedBefore, Owner,
Exclude) and output (NullSeparator, Format, MaxResults, Color).
For lower-level control, the github.com/startvibecoding/go-fd/pkg/finder
package lets you build a finder.Config directly and call finder.New(cfg).
Go module compatibility
The module path is:
github.com/startvibecoding/go-fd
It has no external Go dependencies and declares Go 1.21 as its minimum version.
Other Go projects can depend on it with go get github.com/startvibecoding/go-fd@latest
or a specific tagged version.
When publishing Git tags for Go consumers, use semantic module tags that match
the module path. Because the path does not include a major-version suffix like
/v2, publish library-compatible tags as v0.x.y or v1.x.y. The CLI can
still report the upstream fd compatibility version, such as 10.4.2-go, through
fd --version.
Before pushing a release tag:
gofmt -l .
go vet ./...
go test ./...
go list ./...
Project layout
cmd/fd/ CLI entry point and argument parser
pkg/finder/ Core engine: config, parallel walk, filtering, output, SDK
pkg/glob/ Glob -> regex translation
pkg/ignore/ gitignore-style pattern matching
pkg/filter/ Size, time and owner filters
pkg/format/ Placeholder templates ({}, {/}, {//}, {.}, {/.})
pkg/exec/ Command execution (-x / -X)
fd.go High-level SDK (package gofd)
tests/ Integration tests
Testing
make test # go test ./...
make vet # go vet ./...
License
Licensed under the MIT License.
/var/log
# Execute a command per result
fd -e jpg -x convert {} {.}.png
# Batch execution
fd -e rs -X wc -l
# Custom output template
fd -e go --format '{//} -> {/.}'
Run __INLINE_CODE_29__ for the full option list.
SDK usage
The module root exposes a friendly API in package __INLINE_CODE_30__.
__CODE_BLOCK_7__
__INLINE_CODE_31__
The __INLINE_CODE_32__ struct exposes the same knobs as the CLI: pattern interpretation
(__INLINE_CODE_33__, __INLINE_CODE_34__, __INLINE_CODE_35__), case handling (__INLINE_CODE_36__,
__INLINE_CODE_37__), ignore handling (__INLINE_CODE_38__, __INLINE_CODE_39__, __INLINE_CODE_40__, ...),
traversal (__INLINE_CODE_41__, __INLINE_CODE_42__, __INLINE_CODE_43__, __INLINE_CODE_44__, __INLINE_CODE_45__), filters
(__INLINE_CODE_46__, __INLINE_CODE_47__, __INLINE_CODE_48__, __INLINE_CODE_49__, __INLINE_CODE_50__, __INLINE_CODE_51__,
__INLINE_CODE_52__) and output (__INLINE_CODE_53__, __INLINE_CODE_54__, __INLINE_CODE_55__, __INLINE_CODE_56__).
For lower-level control, the __INLINE_CODE_57__
package lets you build a __INLINE_CODE_58__ directly and call __INLINE_CODE_59__.
Go module compatibility
The module path is:
__CODE_BLOCK_8__
It has no external Go dependencies and declares Go 1.21 as its minimum version.
Other Go projects can depend on it with __INLINE_CODE_60__
or a specific tagged version.
When publishing Git tags for Go consumers, use semantic module tags that match
the module path. Because the path does not include a major-version suffix like
__INLINE_CODE_61__, publish library-compatible tags as __INLINE_CODE_62__ or __INLINE_CODE_63__. The CLI can
still report the upstream fd compatibility version, such as __INLINE_CODE_64__, through
__INLINE_CODE_65__.
Before pushing a release tag:
__CODE_BLOCK_9__
Project layout
__CODE_BLOCK_10__
Testing
__CODE_BLOCK_11__
License
Licensed under the MIT License.