Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ on:
branches:
- '**'
pull_request:
branches:
- master

permissions:
contents: read
Expand All @@ -29,6 +27,6 @@ jobs:
go-version: ${{ env.GO_VERSION }}

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
uses: golangci/golangci-lint-action@v7
with:
version: v1.60.3
version: v2.1.5
64 changes: 38 additions & 26 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
version: "2"
run:
timeout: 2m

linters:
disable-all: true
default: none
enable:
- dupl
- errcheck
- errname
- errorlint
- funlen
- gci
- goconst
- gocritic
- gocyclo
- gofmt
- goimports
- gosec
- gosimple
- govet
- ineffassign
- lll
Expand All @@ -25,29 +21,45 @@ linters:
- prealloc
- revive
- staticcheck
- stylecheck
- thelper
- tparallel
- typecheck
- unconvert
- unparam
- unused
- whitespace

linters-settings:
gosec:
excludes:
- G115
thelper:
test:
begin: false

issues:
exclude-rules:
- path: _test\.go
linters:
- errcheck
- funlen

exclude-dirs:
- benchmarks
settings:
gosec:
excludes:
- G115
thelper:
test:
begin: false
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- linters:
- errcheck
- funlen
path: _test\.go
paths:
- benchmarks
- third_party$
- builtin$
- examples$
formatters:
enable:
- gci
- gofmt
- goimports
exclusions:
generated: lax
paths:
- benchmarks
- third_party$
- builtin$
- examples$
1 change: 1 addition & 0 deletions map_concurrent.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ func (cm *ConcurrentMap[K, V]) Values() []*V {
return values
}

//nolint:staticcheck
func (cm *ConcurrentMap[K, V]) smap() *sync.Map {
for {
if !cm.clearing.Load() {
Expand Down
2 changes: 1 addition & 1 deletion map_sharded.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var _ Map[int, any] = (*ShardedMap[int, any])(nil)
func NewShardedMap[K comparable, V any](shards int) *ShardedMap[K, V] {
return NewShardedMapWithHash[K, V](shards, func(key K) uint64 {
h := fnv.New64a()
h.Write([]byte(fmt.Sprint(key)))
_, _ = fmt.Fprint(h, key)
return h.Sum64()
})
}
Expand Down
6 changes: 5 additions & 1 deletion value.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ type Value struct {

// CompareAndSwap executes the compare-and-swap operation for the Value.
// The current implementation is not atomic.
func (v *Value) CompareAndSwap(old any, new any) (swapped bool) {
//
//nolint:revive
func (v *Value) CompareAndSwap(old, new any) (swapped bool) {
defer func() {
if err := recover(); err != nil {
swapped = false
Expand Down Expand Up @@ -49,6 +51,8 @@ func (v *Value) Store(val any) {
// Swap stores new into Value and returns the previous value.
// It returns nil if the Value is empty.
// Swap(nil) panics.
//
//nolint:revive
func (v *Value) Swap(new any) (old any) {
oldValue := v.p.Swap(initValue(new))
if oldValue != nil {
Expand Down
Loading