Skip to content

fix: golangci-lint findings, third delivery#2167

Merged
CascadingRadium merged 7 commits intoblevesearch:masterfrom
christiangda:fix-golangci-lint-3
Mar 19, 2025
Merged

fix: golangci-lint findings, third delivery#2167
CascadingRadium merged 7 commits intoblevesearch:masterfrom
christiangda:fix-golangci-lint-3

Conversation

@christiangda
Copy link
Contributor

Since I started using this project on my production workloads, I would like to contribute to the project.

This third delivery is still fixing easy stuff like:

  • golangci-lint run ./... | grep "S1001:"
    • search/searcher/search_conjunction.go:53:2: S1001: should use copy(to, from) instead of a loop (gosimple)
    • search/searcher/search_disjunction_slice.go:82:3: S1001: should use copy(to, from) instead of a loop (gosimple)
  • golangci-lint run ./... | grep "ineffectual assignment"->
    • search/sort.go:49:14: ineffectual assignment to ok (ineffassign)
    • index/scorch/reader_test.go:72:2: ineffectual assignment to expectedCount (ineffassign)
    • index/upsidedown/row.go:645:7: ineffectual assignment to arrayPositionsLen (ineffassign)
  • golangci-lint run ./... | grep "S1017:"
    • search/query/regexp.go:72:2: S1017: should replace this if statement with an unconditional strings.TrimPrefix (gosimple)
  • added a new file search/sort_test.go to test a change before and after it
  • minor formatting changes

search/searcher/search_conjunction.go:53:2: S1001: should use copy(to, from) instead of a loop (gosimple)

search/searcher/search_disjunction_slice.go:82:3: S1001: should use copy(to, from) instead of a loop (gosimple)
index/scorch/reader_test.go:72:2: ineffectual assignment to expectedCount (ineffassign)
search/sort.go:49:14: ineffectual assignment to ok (ineffassign)

test: add test tables for function ParseSearchSortObj

test: add unit test before the vadilation of the ok variable and test it after the change
index/upsidedown/row.go:645:7: ineffectual assignment to arrayPositionsLen (ineffassign)
analysis/token/keyword/keyword.go:38:11: SA6001: m[string(key)] would be more efficient than k := string(key); m[k] (staticcheck)
search/query/regexp.go:72:2: S1017: should replace this 'if' statement with an unconditional 'strings.TrimPrefix' (gosimple)
@CascadingRadium CascadingRadium merged commit deb5230 into blevesearch:master Mar 19, 2025
9 checks passed
@christiangda christiangda deleted the fix-golangci-lint-3 branch April 22, 2025 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants