doublestar

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

Library
Go
vv4.10.2
718 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
71 /100 Good
Development Activity 72
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
49%
MIT

Bytebase

Devops

14,512

An open-source database CI/CD and DevSecOps platform — schema migration review, GitOps-driven changes, data masking, and access control across MySQL, PostgreSQL, Oracle, Snowflake, MongoDB, and more.

View details
92
Repo Health
73
Technical
68
Dependency
Built with
Go 49%
TypeScript 42%
Updated 1 weeks ago
Go
75%
AGPL 3.0

Coder

Code Editors · Developer Tools · Devops

16,729

Self-hosted cloud development environments and AI coding agents — defined in Terraform, connected via WireGuard, automatically shut down when idle.

View details
91
Repo Health
90
Technical
65
Dependency
Built with
Go 75%
TypeScript 23%
Updated 1 weeks ago
Go
98%
Other

Crush

AI Assistants · AI Code Assistants · Developer Tools

28,331

Your terminal coding companion — wire up any LLM with LSP intelligence, MCP extensibility, and a skills system that learns your workflow.

View details
87
Repo Health
86
Technical
68
Dependency
Built with
Go 98%
Updated 1 weeks ago
Go
75%
MIT

Digger

Automation · Developer Tools · Devops

5,044

Run Terraform and OpenTofu natively inside your existing CI pipeline — no separate runners, no third-party secrets, no extra compute costs.

View details
74
Repo Health
73
Technical
67
Dependency
Built with
Go 75%
TypeScript 15%
Updated 2 weeks ago
Go
52%
AGPL 3.0

Filestash

File Storage

14,734

A self-hosted file management platform that unifies access to S3, SFTP, SMB, FTP, WebDAV, NFS, Git, SharePoint, and 20+ other storage backends through a single extensible web interface.

View details
79
Repo Health
67
Technical
67
Dependency
Built with
Go 52%
JavaScript 34%
Updated 2 weeks ago
Go
62%
Apache 2.0

Harness Open Source

Code Editors · Developer Tools · Devops

38,450

A unified open source DevOps platform combining Git hosting, CI/CD pipelines, cloud development environments, and artifact registries in a single self-hosted system.

View details
89
Repo Health
79
Technical
64
Dependency
Built with
Go 62%
TypeScript 33%
Updated 2 weeks ago
TypeScript
97%
Other

Infisical

Devops · Security

29,468

The open-source platform for secrets, certificates, privileged access, and AI agent security — all in one self-hostable system.

View details
91
Repo Health
84
Technical
65
Dependency
Built with
TypeScript 97%
Updated 1 weeks ago
Go
97%
Apache 2.0

infracost

Developer Tools · Devops

12,539

Infracost shows cloud cost estimates for Terraform, CloudFormation, and AWS CDK before you deploy — in your terminal, editor, AI coding agent, and pull requests.

View details
82
Repo Health
78
Technical
67
Dependency
Built with
Go 97%
Updated 2 weeks ago
Go
95%
MIT

cli

Developer Tools · Team Chat

17,477

The official Lark/Feishu CLI tool built for both humans and AI agents, delivering 200+ commands and 26 AI agent skills across 18 business domains from messaging and calendar to docs, sheets, and approvals.

View details
84
Repo Health
83
Technical
75
Dependency
Built with
Go 95%
Updated 1 weeks 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