From 62b38ff78ae7970fcb3f02bc315c4e8125945f09 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 May 2026 07:51:24 +0000 Subject: [PATCH] Bump github.com/sahilm/fuzzy from 0.1.1 to 0.1.2 Bumps [github.com/sahilm/fuzzy](https://github.com/sahilm/fuzzy) from 0.1.1 to 0.1.2. - [Release notes](https://github.com/sahilm/fuzzy/releases) - [Commits](https://github.com/sahilm/fuzzy/compare/v0.1.1...v0.1.2) --- updated-dependencies: - dependency-name: github.com/sahilm/fuzzy dependency-version: 0.1.2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 3 +- go.sum | 4 +- vendor/github.com/sahilm/fuzzy/.travis.yml | 8 --- vendor/github.com/sahilm/fuzzy/Gopkg.lock | 20 ------- vendor/github.com/sahilm/fuzzy/Gopkg.toml | 4 -- vendor/github.com/sahilm/fuzzy/Makefile | 66 +++++++++++----------- vendor/github.com/sahilm/fuzzy/fuzzy.go | 27 ++++++--- vendor/modules.txt | 6 +- 8 files changed, 57 insertions(+), 81 deletions(-) delete mode 100644 vendor/github.com/sahilm/fuzzy/.travis.yml delete mode 100644 vendor/github.com/sahilm/fuzzy/Gopkg.lock delete mode 100644 vendor/github.com/sahilm/fuzzy/Gopkg.toml diff --git a/go.mod b/go.mod index 1a64c445f..d2d645ae8 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,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.1 + github.com/sahilm/fuzzy v0.1.2 github.com/samber/lo v1.53.0 github.com/sanity-io/litter v1.5.8 github.com/sasha-s/go-deadlock v0.3.9 @@ -58,7 +58,6 @@ require ( github.com/invopop/jsonschema v0.10.0 // indirect github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 // indirect github.com/kr/pretty v0.3.1 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect diff --git a/go.sum b/go.sum index 0fa338e30..792d90f62 100644 --- a/go.sum +++ b/go.sum @@ -107,8 +107,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.1 h1:ceu5RHF8DGgoi+/dR5PsECjCDH1BE3Fnmpo7aVXOdRA= -github.com/sahilm/fuzzy v0.1.1/go.mod h1:VFvziUEIMCrT6A6tw2RFIXPXXmzXbOsSHF0DOI8ZK9Y= +github.com/sahilm/fuzzy v0.1.2 h1:kdSkz23lx1meNjEl+SLJULeSbjTI4Dn14K/YxdGrIww= +github.com/sahilm/fuzzy v0.1.2/go.mod h1:au6//VbVSqu6DFrkL2CfjlJ5iURpNCPeE+1GwY3XsT8= github.com/samber/lo v1.53.0 h1:t975lj2py4kJPQ6haz1QMgtId2gtmfktACxIXArw3HM= github.com/samber/lo v1.53.0/go.mod h1:4+MXEGsJzbKGaUEQFKBq2xtfuznW9oz/WrgyzMzRoM0= github.com/sanity-io/litter v1.5.8 h1:uM/2lKrWdGbRXDrIq08Lh9XtVYoeGtcQxk9rtQ7+rYg= diff --git a/vendor/github.com/sahilm/fuzzy/.travis.yml b/vendor/github.com/sahilm/fuzzy/.travis.yml deleted file mode 100644 index f77acde75..000000000 --- a/vendor/github.com/sahilm/fuzzy/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -arch: - - amd64 - - ppc64le -language: go -go: - - 1.x -script: - - make diff --git a/vendor/github.com/sahilm/fuzzy/Gopkg.lock b/vendor/github.com/sahilm/fuzzy/Gopkg.lock deleted file mode 100644 index 6e3a7fe54..000000000 --- a/vendor/github.com/sahilm/fuzzy/Gopkg.lock +++ /dev/null @@ -1,20 +0,0 @@ -# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. - - -[[projects]] - branch = "master" - digest = "1:ee97ec8a00b2424570c1ce53d7b410e96fbd4c241b29df134276ff6aa3750335" - name = "github.com/kylelemons/godebug" - packages = [ - "diff", - "pretty", - ] - pruneopts = "" - revision = "d65d576e9348f5982d7f6d83682b694e731a45c6" - -[solve-meta] - analyzer-name = "dep" - analyzer-version = 1 - input-imports = ["github.com/kylelemons/godebug/pretty"] - solver-name = "gps-cdcl" - solver-version = 1 diff --git a/vendor/github.com/sahilm/fuzzy/Gopkg.toml b/vendor/github.com/sahilm/fuzzy/Gopkg.toml deleted file mode 100644 index 8f96b112e..000000000 --- a/vendor/github.com/sahilm/fuzzy/Gopkg.toml +++ /dev/null @@ -1,4 +0,0 @@ -# Test dependency -[[constraint]] - branch = "master" - name = "github.com/kylelemons/godebug" diff --git a/vendor/github.com/sahilm/fuzzy/Makefile b/vendor/github.com/sahilm/fuzzy/Makefile index 7fa2be4ec..8d150cdd9 100644 --- a/vendor/github.com/sahilm/fuzzy/Makefile +++ b/vendor/github.com/sahilm/fuzzy/Makefile @@ -1,14 +1,10 @@ .PHONY: all all: setup lint test +PKGS := $(shell go list ./... | grep -v /vendor) .PHONY: test test: setup - go test -bench ./... - -.PHONY: cover -cover: setup - mkdir -p coverage - gocov test ./... | gocov-html > coverage/coverage.html + go test $(PKGS) sources = $(shell find . -name '*.go' -not -path './vendor/*') .PHONY: goimports @@ -17,41 +13,47 @@ goimports: setup .PHONY: lint lint: setup - gometalinter ./... --enable=goimports --disable=gocyclo --vendor -t + $(BIN_DIR)/golangci-lint run + +COVERAGE := $(CURDIR)/coverage +COVER_PROFILE :=$(COVERAGE)/cover.out +TMP_COVER_PROFILE :=$(COVERAGE)/cover.tmp +.PHONY: cover +cover: setup + rm -rf $(COVERAGE) + mkdir -p $(COVERAGE) + echo "mode: set" > $(COVER_PROFILE) + for pkg in $(PKGS); do \ + go test -v -coverprofile=$(TMP_COVER_PROFILE) $$pkg; \ + if [ -f $(TMP_COVER_PROFILE) ]; then \ + grep -v 'mode: set' $(TMP_COVER_PROFILE) >> $(COVER_PROFILE); \ + rm $(TMP_COVER_PROFILE); \ + fi; \ + done + go tool cover -html=$(COVER_PROFILE) -o $(COVERAGE)/index.html + +.PHONY: ci +ci: setup lint test .PHONY: install install: setup - go install + go install $(PKGS) +.PHONY: build +build: setup + go build $(PKGS) + +GOPATH ?= $(HOME)/go BIN_DIR := $(GOPATH)/bin GOIMPORTS := $(BIN_DIR)/goimports -GOMETALINTER := $(BIN_DIR)/gometalinter -DEP := $(BIN_DIR)/dep -GOCOV := $(BIN_DIR)/gocov -GOCOV_HTML := $(BIN_DIR)/gocov-html +GOLANG_CI_LINT := $(BIN_DIR)/golangci-lint $(GOIMPORTS): go get -u golang.org/x/tools/cmd/goimports -$(GOMETALINTER): - go get -u github.com/alecthomas/gometalinter - gometalinter --install &> /dev/null +$(GOLANG_CI_LINT): + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(BIN_DIR) v2.12.2 -$(GOCOV): - go get -u github.com/axw/gocov/gocov +tools: $(GOIMPORTS) $(GOLANG_CI_LINT) -$(GOCOV_HTML): - go get -u gopkg.in/matm/v1/gocov-html - -$(DEP): - go get -u github.com/golang/dep/cmd/dep - -tools: $(GOIMPORTS) $(GOMETALINTER) $(GOCOV) $(GOCOV_HTML) $(DEP) - -vendor: $(DEP) - dep ensure - -setup: tools vendor - -updatedeps: - dep ensure -update +setup: tools diff --git a/vendor/github.com/sahilm/fuzzy/fuzzy.go b/vendor/github.com/sahilm/fuzzy/fuzzy.go index 5125821fd..54eb98fb2 100644 --- a/vendor/github.com/sahilm/fuzzy/fuzzy.go +++ b/vendor/github.com/sahilm/fuzzy/fuzzy.go @@ -7,6 +7,7 @@ package fuzzy import ( "sort" + "strings" "unicode" "unicode/utf8" ) @@ -39,7 +40,7 @@ type Matches []Match func (a Matches) Len() int { return len(a) } func (a Matches) Swap(i, j int) { a[i], a[j] = a[j], a[i] } -func (a Matches) Less(i, j int) bool { return a[i].Score >= a[j].Score } +func (a Matches) Less(i, j int) bool { return a[i].Score > a[j].Score } // Source represents an abstract source of a list of strings. Source must be iterable type such as a slice. // The source will be iterated over till Len() with String(i) being called for each element where i is the @@ -114,7 +115,15 @@ func FindFromNoSort(pattern string, data Source) Matches { var matchedIndexes []int for i := 0; i < data.Len(); i++ { var match Match - match.Str = data.String(i) + matchStr := data.String(i) + match.Str = matchStr + // Limit matching to the first NUL rune, if any. We could maybe replace it + // with whitespace, but this way doesn't allocate so much, and the presence + // of NULs is most often an error by the library user. + cleanMatchStr := matchStr + if nullI := strings.IndexRune(matchStr, 0); nullI > -1 { + cleanMatchStr = cleanMatchStr[:nullI] + } match.Index = i if matchedIndexes != nil { match.MatchedIndexes = matchedIndexes @@ -128,10 +137,10 @@ func FindFromNoSort(pattern string, data Source) Matches { currAdjacentMatchBonus := 0 var last rune var lastIndex int - nextc, nextSize := utf8.DecodeRuneInString(data.String(i)) + nextc, nextSize := utf8.DecodeRuneInString(cleanMatchStr) var candidate rune var candidateSize int - for j := 0; j < len(data.String(i)); j += candidateSize { + for j := 0; j < len(cleanMatchStr); j += candidateSize { candidate, candidateSize = nextc, nextSize if equalFold(candidate, runes[patternIndex]) { score = 0 @@ -161,11 +170,11 @@ func FindFromNoSort(pattern string, data Source) Matches { if patternIndex < len(runes)-1 { nextp = runes[patternIndex+1] } - if j+candidateSize < len(data.String(i)) { - if data.String(i)[j+candidateSize] < utf8.RuneSelf { // Fast path for ASCII - nextc, nextSize = rune(data.String(i)[j+candidateSize]), 1 + if j+candidateSize < len(cleanMatchStr) { + if cleanMatchStr[j+candidateSize] < utf8.RuneSelf { // Fast path for ASCII + nextc, nextSize = rune(cleanMatchStr[j+candidateSize]), 1 } else { - nextc, nextSize = utf8.DecodeRuneInString(data.String(i)[j+candidateSize:]) + nextc, nextSize = utf8.DecodeRuneInString(cleanMatchStr[j+candidateSize:]) } } else { nextc, nextSize = 0, 0 @@ -192,7 +201,7 @@ func FindFromNoSort(pattern string, data Source) Matches { last = candidate } // apply penalty for each unmatched character - penalty := len(match.MatchedIndexes) - len(data.String(i)) + penalty := len(match.MatchedIndexes) - len(cleanMatchStr) match.Score += penalty if len(match.MatchedIndexes) == len(runes) { matches = append(matches, match) diff --git a/vendor/modules.txt b/vendor/modules.txt index 4adeb40f0..e60827c69 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -93,8 +93,6 @@ github.com/karimkhaleel/jsonschema github.com/kr/logfmt # github.com/kr/pretty v0.3.1 ## explicit; go 1.12 -# github.com/kylelemons/godebug v1.1.0 -## explicit; go 1.11 # github.com/kyokomi/emoji/v2 v2.2.13 ## explicit; go 1.14 github.com/kyokomi/emoji/v2 @@ -132,8 +130,8 @@ 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.1 -## explicit +# github.com/sahilm/fuzzy v0.1.2 +## explicit; go 1.24.5 github.com/sahilm/fuzzy # github.com/samber/lo v1.53.0 ## explicit; go 1.18