doublestar

Fast, io/fs-based Go library for glob and doublestar (**) pattern matching in file paths.

Library
Go
vv4.10.3
720 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
70 /100 Good
Development Activity 68
Maintenance 60
Community 64
Maturity 60
Momentum 28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
74 /100 Good
Architecture 82
Code Quality 80
Innovation 68
Learning Curve 65

doublestar is a Go library that implements globbing and pattern matching for file paths, extending the standard path.Match and filepath.Glob semantics with support for double-star (**) recursive wildcards familiar from Bash’s globstar. Version 4 is a ground-up rewrite built around Go’s io/fs package, letting it glob against any fs.FS implementation — the real filesystem, embed.FS, in-memory filesystems, or remote/virtual ones — rather than being tied to the OS filesystem.

The library exposes drop-in replacements for Match, PathMatch, and Glob, plus a GlobWalk function that streams matches to a callback instead of collecting them all in memory, and a suite of GlobOptions (case-insensitive matching, hidden-file exclusion, symlink handling, fail-on-IO-error behavior) for tuning matching behavior without changing the pattern syntax.

What You Get

  • Match() and PathMatch() functions as drop-in replacements for path.Match() and filepath.Match(), with ** support
  • Glob() and GlobWalk() for filesystem globbing against any io/fs.FS, including embed.FS
  • FilepathGlob() convenience wrapper for direct OS-filesystem globbing
  • GlobOption modifiers: WithCaseInsensitive, WithFilesOnly, WithNoFollow, WithNoHidden, WithFailOnIOErrors, WithFailOnPatternNotExist
  • SplitPattern() helper for dividing a pattern into a static base path and the remaining glob pattern, useful for initializing scoped fs.FS roots
  • ValidatePattern() and ValidatePathPattern() for pre-checking user-supplied patterns before use

Common Use Cases

  • Recursively matching source files (e.g. **/*.go) for build tools, linters, or code generators
  • Filtering files inside an embed.FS for static asset bundling
  • Implementing .gitignore-style or glob-based include/exclude rules in CLI tools
  • Validating user-supplied glob patterns in configuration files before running a scan

Under The Hood

Architecture

doublestar is organized as a flat package with clear separation of concerns: match.go implements pure pattern matching (Match/PathMatch) with no filesystem dependency, glob.go implements filesystem globbing built on internal doGlob/doGlobWalk recursion, globwalk.go implements the streaming GlobWalk variant, globoptions.go implements a functional-options pattern (GlobOption) shared by Glob and GlobWalk, utils.go plus platform-specific utils_unix.go/utils_windows.go isolate OS-specific path and file-attribute logic behind build tags, and validate.go implements pattern well-formedness checking shared by both the matching and globbing code paths. Because core matching logic has zero dependency on any filesystem, the only integration point needed to glob a new source (embed.FS, an in-memory filesystem, a virtual filesystem) is the fsys argument passed to Glob/GlobWalk.

Tech Stack

The module targets Go 1.16+ (github.com/bmatcuk/doublestar/v4) and declares zero third-party dependencies — go.mod contains nothing beyond the module directive itself. It is built entirely on the standard library: io/fs for filesystem abstraction, path and path/filepath for separator-aware matching, and errors for sentinel error values. Tooling is plain go test, with CI running on GitHub Actions across ubuntu-latest and windows-latest, using go test -race -coverprofile on Linux and uploading coverage to Codecov. There is no deployment target — the package is distributed via Go modules, with the v4 suffix in the import path following Go’s semantic-import-versioning convention for major-version bumps.

Code Quality

doublestar_test.go is the primary suite at nearly 1,000 lines, using heavily table-driven tests in the idiomatic Go testing package with no external assertion library; globwalk_test.go and platform-specific utils_test.go/utils_unix_test.go/utils_windows_test.go round out coverage. Error handling uses explicit sentinel errors (ErrBadPattern, ErrPatternNotExist) returned directly rather than panics, and *Unvalidated function variants exist specifically so callers can skip re-validation once they’ve already validated a pattern, favoring explicit opt-in over implicit magic. Naming is consistent and idiomatic (exported CamelCase, doc comments preceding every exported symbol), and CI enforces go test -race with tracked coverage on every push and pull request; no linter configuration is checked in.

What Makes It Unique

The library’s defining choice is targeting io/fs.FS rather than the OS filesystem directly — something the standard library’s filepath.Glob() cannot do — which lets callers glob against embed.FS, in-memory filesystems, or any custom fs.FS implementation with the same API. The functional-options GlobOption pattern (WithCaseInsensitive, WithNoHidden, WithFilesOnly, and others) extends matching behavior cleanly without a combinatorial explosion of function variants, and the callback-based GlobWalk API avoids building large in-memory result slices when walking big trees. The public API closely mirrors path.Match/filepath.Glob signatures, keeping the learning curve low for anyone already familiar with Go’s built-in globbing.

Used by 19 apps in this directory

Go
81%
GPL 3.0

Navidrome

File Storage · Music Audio

24,331

Run your own personal Spotify — stream your entire music collection from any device, anywhere, forever.

View details
91
Repo Health
81
Technical
66
Dependency
Built with
Go 81%
JavaScript 15%
Updated 1 weeks ago
Go
48%
GPL 3.0

Netdata

Devops · Monitoring

81,111

Real-time per-second metrics, ML-powered anomaly detection, and zero-config observability for any infrastructure.

View details
93
Repo Health
86
Technical
70
Dependency
Built with
Go 48%
C 29%
Rust 15%
Updated 6 days ago
Go
69%
Apache 2.0

open-code-review

Developer Tools · Devops

48,167

The AI code review agent born at Alibaba's scale — combining deterministic engineering with LLM intelligence for precise, token-efficient reviews.

View details
82
Repo Health
83
Technical
73
Dependency
Built with
Go 69%
JavaScript 12%
Updated 1 weeks ago
Python
39%
Apache 2.0

OpenSandbox

Developer Tools · Security

16,116

Secure, fast, and extensible sandbox runtime for AI agents with multi-language SDKs and Docker/Kubernetes runtimes.

View details
85
Repo Health
81
Technical
70
Dependency
Built with
Python 39%
Go 36%
Updated 6 days ago
Go
91%
Apache 2.0

Ory Kratos

Authentication

13,933

API-first identity and user management that handles login, registration, MFA, and recovery so your application never has to.

View details
69
Repo Health
78
Technical
65
Dependency
Built with
Go 91%
Updated 3 months ago
Go
40%
Apache 2.0

Rill

Analytics · Data Engineering

2,962

The fastest BI tool for humans and agents — define metrics, models, and dashboards as code and query them instantly on ClickHouse or DuckDB.

View details
88
Repo Health
88
Technical
64
Dependency
Built with
Go 40%
TypeScript 38%
Svelte 21%
Updated 6 days ago
Go
75%
AGPL 3.0

Teleport

Authentication · Security

21,016

Zero-trust infrastructure access platform that replaces credentials and VPNs with short-lived certificates, SSO, and identity-aware proxies for SSH, Kubernetes, databases, RDP, and AI agents.

View details
94
Repo Health
81
Technical
68
Dependency
Built with
Go 75%
TypeScript 16%
Updated 1 weeks ago
Go
99%
Apache 2.0

Tusk

AI Code Assistants · Developer Tools · Devops

143

Record live API traffic and replay it as deterministic, sandboxed tests, plus AI code review and unit test generation, all from one Go CLI built by YC W2024's Use-Tusk.

View details
42
Repo Health
77
Technical
76
Dependency
Built with
Go 99%
Updated 5 months ago
Go
59%
AGPL 3.0

Unkey

Developer Tools

5,475

An open-source developer platform for API infrastructure — issue and verify API keys, enforce global rate limits, route traffic through a gateway, and get per-key analytics and audit logs.

View details
91
Repo Health
70
Technical
68
Dependency
Built with
Go 59%
TypeScript 40%
Updated 6 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers