Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
esafonov committed Nov 4, 2024
1 parent f83a4a3 commit 6eeb686
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 2 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: golangci-lint
on:
push:
branches:
- main
- master
pull_request:

permissions:
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
# pull-requests: read

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: stable
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.60
42 changes: 42 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
run:
timeout: 5m
issues-exit-code: 1
tests: true

issues:
max-same-issues: 100
include:
- EXC0012
- EXC0014
exclude-dirs: []
exclude-rules:
- path: retry_test.go
linters:
- revive
text: "this block is empty"
fix: true

linters:
enable:
- bodyclose
- gofumpt
- goimports
- gosec
- gosimple
- govet
- ineffassign
- misspell
- revive
- staticcheck
- typecheck
- unused
- whitespace

output:
formats:
- format: colored-line-number
print-issued-lines: true
print-linter-name: true
uniq-by-line: true
path-prefix: ""
sort-results: true
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
[![CI State](https://github.com/gotidy/iters/.github/workflows/go.yml/badge.svg)](https://github.com/gotidy/iters/actions)
[![Go Doc](https://godoc.org/github.com/gotidy/iters?status.svg)](https://pkg.go.dev/github.com/gotidy/iters)

# iters

Go iterators.

## Installation

```go
go get github.com/gotidy/iters
```

## General Iterators

The `iters` library provides a set of general-purpose iterators that simplify the process of transformation, creation and using collections.
Expand Down
4 changes: 2 additions & 2 deletions iters.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ func CountFunc[V any](s iter.Seq[V], f func(V) bool) int {
return count
}

// Count values.
// Count2 values.
func Count2[K, V any](s iter.Seq2[K, V]) int {
var count int
for range s {
Expand Down Expand Up @@ -425,7 +425,7 @@ func jitter[T constraints.Float | constraints.Integer](v T, factor, random float
func Jitter[T constraints.Float | constraints.Integer](vv iter.Seq[T], factor float64) iter.Seq[T] {
return func(yield func(T) bool) {
jitter := func(v T) T {
return jitter(v, factor, float64(rand.Uint64())*2/math.MaxUint64-1)
return jitter(v, factor, float64(rand.Uint64())*2/math.MaxUint64-1) //nolint:gosec
}
if factor == 0 {
jitter = func(v T) T { return v }
Expand Down

0 comments on commit 6eeb686

Please sign in to comment.