Skip to content

cristalhq/glob

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

glob

build-img pkg-img version-img

Glob pattern matching in Go. See Wikipedia.

Rationale

TODO

Features

  • Simple API.
  • Dependency-free.
  • Clean and tested code.
  • Support for **.
  • Walk & find for fs.FS.

See docs or GUIDE.md for more details.

Install

Go version 1.18+

go get github.com/cristalhq/glob

Example

pattern := `foo/**/*.go`
matcher := glob.MustCompile(pattern, '/')

ctx, cancel := context.WithCancel(context.Bacg)
glob.Walk(ctx)
fmt.Printf("For pattern `%s`:\n", pattern)
for _, path := range paths {
	fmt.Printf("%15s %v\n", path, matcher.Match(path))
}

See examples: example_test.go.

License

MIT License.

About

Glob pattern matching in Go.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages