Bump github.com/sahilm/fuzzy from 0.1.0 to 0.1.1 (#5459)

Bumps [github.com/sahilm/fuzzy](https://github.com/sahilm/fuzzy) from
0.1.0 to 0.1.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/sahilm/fuzzy/releases">github.com/sahilm/fuzzy's
releases</a>.</em></p>
<blockquote>
<h2>v0.1.1</h2>
<h2>What's Changed</h2>
<ul>
<li>Fix typo by <a
href="https://github.com/vlad-stoian"><code>@​vlad-stoian</code></a> in
<a
href="https://redirect.github.com/sahilm/fuzzy/pull/15">sahilm/fuzzy#15</a></li>
<li>AddingPowerSupport_For_golang-github-sahilm-fuzzy by <a
href="https://github.com/santosh653"><code>@​santosh653</code></a> in <a
href="https://redirect.github.com/sahilm/fuzzy/pull/18">sahilm/fuzzy#18</a></li>
<li>feat: fuzzy find without sorting by <a
href="https://github.com/caarlos0"><code>@​caarlos0</code></a> in <a
href="https://redirect.github.com/sahilm/fuzzy/pull/22">sahilm/fuzzy#22</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a
href="https://github.com/vlad-stoian"><code>@​vlad-stoian</code></a>
made their first contribution in <a
href="https://redirect.github.com/sahilm/fuzzy/pull/15">sahilm/fuzzy#15</a></li>
<li><a
href="https://github.com/santosh653"><code>@​santosh653</code></a> made
their first contribution in <a
href="https://redirect.github.com/sahilm/fuzzy/pull/18">sahilm/fuzzy#18</a></li>
<li><a href="https://github.com/caarlos0"><code>@​caarlos0</code></a>
made their first contribution in <a
href="https://redirect.github.com/sahilm/fuzzy/pull/22">sahilm/fuzzy#22</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/sahilm/fuzzy/compare/v0.1.0...v0.1.1">https://github.com/sahilm/fuzzy/compare/v0.1.0...v0.1.1</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="c48e322e2a"><code>c48e322</code></a>
feat: fuzzy find without sorting</li>
<li><a
href="c72cd382d3"><code>c72cd38</code></a>
Update .travis.yml</li>
<li><a
href="d88f8cb825"><code>d88f8cb</code></a>
Fix typo</li>
<li><a
href="eaa29a3062"><code>eaa29a3</code></a>
Better description of <code>FindFrom</code></li>
<li><a
href="485b11793d"><code>485b117</code></a>
Fix typo</li>
<li>See full diff in <a
href="https://github.com/sahilm/fuzzy/compare/v0.1.0...v0.1.1">compare
view</a></li>
</ul>
</details>
<br />
This commit is contained in:
Stefan Haller 2026-04-01 11:23:47 +02:00 committed by GitHub
commit 8aaed47c63
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 32 additions and 8 deletions

2
go.mod
View file

@ -27,7 +27,7 @@ require (
github.com/mgutz/str v1.2.0
github.com/mitchellh/go-ps v1.0.0
github.com/rivo/uniseg v0.4.7
github.com/sahilm/fuzzy v0.1.0
github.com/sahilm/fuzzy v0.1.1
github.com/samber/lo v1.31.0
github.com/sanity-io/litter v1.5.8
github.com/sasha-s/go-deadlock v0.3.6

4
go.sum
View file

@ -103,8 +103,8 @@ github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUc
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
github.com/sahilm/fuzzy v0.1.0 h1:FzWGaw2Opqyu+794ZQ9SYifWv2EIXpwP4q8dY1kDAwI=
github.com/sahilm/fuzzy v0.1.0/go.mod h1:VFvziUEIMCrT6A6tw2RFIXPXXmzXbOsSHF0DOI8ZK9Y=
github.com/sahilm/fuzzy v0.1.1 h1:ceu5RHF8DGgoi+/dR5PsECjCDH1BE3Fnmpo7aVXOdRA=
github.com/sahilm/fuzzy v0.1.1/go.mod h1:VFvziUEIMCrT6A6tw2RFIXPXXmzXbOsSHF0DOI8ZK9Y=
github.com/samber/lo v1.31.0 h1:Sfa+/064Tdo4SvlohQUQzBhgSer9v/coGvKQI/XLWAM=
github.com/samber/lo v1.31.0/go.mod h1:HLeWcJRRyLKp3+/XBJvOrerCQn9mhdKMHyd7IRlgeQ8=
github.com/sanity-io/litter v1.5.8 h1:uM/2lKrWdGbRXDrIq08Lh9XtVYoeGtcQxk9rtQ7+rYg=

View file

@ -1,3 +1,6 @@
arch:
- amd64
- ppc64le
language: go
go:
- 1.x

View file

@ -17,7 +17,7 @@ VSCode, IntelliJ IDEA et al. This library is external dependency-free. It only d
- Speed. Matches are returned in milliseconds. It's perfect for interactive search boxes.
- The positions of matches is returned. Allows you to highlight matching characters.
- The positions of matches are returned. Allows you to highlight matching characters.
- Unicode aware.
@ -76,7 +76,7 @@ func contains(needle int, haystack []int) bool {
return false
}
```
If the data you want to match isn't a slice of strings, you can use `FindFromSource` by implementing
If the data you want to match isn't a slice of strings, you can use `FindFrom` by implementing
the provided `Source` interface. Here's an example:
```go
@ -119,7 +119,9 @@ func main() {
},
}
results := fuzzy.FindFrom("al", emps)
fmt.Println(results)
for _, r := range results {
fmt.Println(emps[r.Index])
}
}
```

View file

@ -76,16 +76,36 @@ The following types of matches apply a bonus:
Penalties are applied for every character in the search string that wasn't matched and all leading
characters upto the first match.
Results are sorted by best match.
*/
func Find(pattern string, data []string) Matches {
return FindFrom(pattern, stringSource(data))
}
/*
FindNoSort is an alternative Find implementation that does not sort
the results in the end.
*/
func FindNoSort(pattern string, data []string) Matches {
return FindFromNoSort(pattern, stringSource(data))
}
/*
FindFrom is an alternative implementation of Find using a Source
instead of a list of strings.
*/
func FindFrom(pattern string, data Source) Matches {
matches := FindFromNoSort(pattern, data)
sort.Stable(matches)
return matches
}
/*
FindFromNoSort is an alternative FindFrom implementation that does
not sort results in the end.
*/
func FindFromNoSort(pattern string, data Source) Matches {
if len(pattern) == 0 {
return nil
}
@ -181,7 +201,6 @@ func FindFrom(pattern string, data Source) Matches {
matchedIndexes = match.MatchedIndexes[:0] // Recycle match index slice
}
}
sort.Stable(matches)
return matches
}

2
vendor/modules.txt vendored
View file

@ -156,7 +156,7 @@ github.com/pmezard/go-difflib/difflib
github.com/rivo/uniseg
# github.com/rogpeppe/go-internal v1.14.1
## explicit; go 1.23
# github.com/sahilm/fuzzy v0.1.0
# github.com/sahilm/fuzzy v0.1.1
## explicit
github.com/sahilm/fuzzy
# github.com/samber/lo v1.31.0