Skip to content

Commit 9454a77

Browse files
authored
ci: upgrade golangci-lint to v2.1.5 (#41)
1 parent 53f371f commit 9454a77

File tree

5 files changed

+47
-32
lines changed

5 files changed

+47
-32
lines changed

.github/workflows/golangci-lint.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ on:
55
branches:
66
- '**'
77
pull_request:
8-
branches:
9-
- master
108

119
permissions:
1210
contents: read
@@ -29,6 +27,6 @@ jobs:
2927
go-version: ${{ env.GO_VERSION }}
3028

3129
- name: Run golangci-lint
32-
uses: golangci/golangci-lint-action@v6
30+
uses: golangci/golangci-lint-action@v7
3331
with:
34-
version: v1.60.3
32+
version: v2.1.5

.golangci.yml

Lines changed: 38 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
1+
version: "2"
12
run:
23
timeout: 2m
3-
44
linters:
5-
disable-all: true
5+
default: none
66
enable:
77
- dupl
88
- errcheck
99
- errname
1010
- errorlint
1111
- funlen
12-
- gci
1312
- goconst
1413
- gocritic
1514
- gocyclo
16-
- gofmt
17-
- goimports
1815
- gosec
19-
- gosimple
2016
- govet
2117
- ineffassign
2218
- lll
@@ -25,29 +21,45 @@ linters:
2521
- prealloc
2622
- revive
2723
- staticcheck
28-
- stylecheck
2924
- thelper
3025
- tparallel
31-
- typecheck
3226
- unconvert
3327
- unparam
3428
- unused
3529
- whitespace
36-
37-
linters-settings:
38-
gosec:
39-
excludes:
40-
- G115
41-
thelper:
42-
test:
43-
begin: false
44-
45-
issues:
46-
exclude-rules:
47-
- path: _test\.go
48-
linters:
49-
- errcheck
50-
- funlen
51-
52-
exclude-dirs:
53-
- benchmarks
30+
settings:
31+
gosec:
32+
excludes:
33+
- G115
34+
thelper:
35+
test:
36+
begin: false
37+
exclusions:
38+
generated: lax
39+
presets:
40+
- comments
41+
- common-false-positives
42+
- legacy
43+
- std-error-handling
44+
rules:
45+
- linters:
46+
- errcheck
47+
- funlen
48+
path: _test\.go
49+
paths:
50+
- benchmarks
51+
- third_party$
52+
- builtin$
53+
- examples$
54+
formatters:
55+
enable:
56+
- gci
57+
- gofmt
58+
- goimports
59+
exclusions:
60+
generated: lax
61+
paths:
62+
- benchmarks
63+
- third_party$
64+
- builtin$
65+
- examples$

map_concurrent.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ func (cm *ConcurrentMap[K, V]) Values() []*V {
136136
return values
137137
}
138138

139+
//nolint:staticcheck
139140
func (cm *ConcurrentMap[K, V]) smap() *sync.Map {
140141
for {
141142
if !cm.clearing.Load() {

map_sharded.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ var _ Map[int, any] = (*ShardedMap[int, any])(nil)
2424
func NewShardedMap[K comparable, V any](shards int) *ShardedMap[K, V] {
2525
return NewShardedMapWithHash[K, V](shards, func(key K) uint64 {
2626
h := fnv.New64a()
27-
h.Write([]byte(fmt.Sprint(key)))
27+
_, _ = fmt.Fprint(h, key)
2828
return h.Sum64()
2929
})
3030
}

value.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ type Value struct {
1414

1515
// CompareAndSwap executes the compare-and-swap operation for the Value.
1616
// The current implementation is not atomic.
17-
func (v *Value) CompareAndSwap(old any, new any) (swapped bool) {
17+
//
18+
//nolint:revive
19+
func (v *Value) CompareAndSwap(old, new any) (swapped bool) {
1820
defer func() {
1921
if err := recover(); err != nil {
2022
swapped = false
@@ -49,6 +51,8 @@ func (v *Value) Store(val any) {
4951
// Swap stores new into Value and returns the previous value.
5052
// It returns nil if the Value is empty.
5153
// Swap(nil) panics.
54+
//
55+
//nolint:revive
5256
func (v *Value) Swap(new any) (old any) {
5357
oldValue := v.p.Swap(initValue(new))
5458
if oldValue != nil {

0 commit comments

Comments
 (0)