summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.golangci.yml1
-rw-r--r--lib/containers/syncmap.go6
2 files changed, 5 insertions, 2 deletions
diff --git a/.golangci.yml b/.golangci.yml
index 7dd7f00..d5c6e53 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -27,7 +27,6 @@ linters:
- cyclop
- exhaustive
- exhaustruct
- - forcetypeassert
- funlen
- gci
- gochecknoglobals
diff --git a/lib/containers/syncmap.go b/lib/containers/syncmap.go
index fb7f59b..4af678f 100644
--- a/lib/containers/syncmap.go
+++ b/lib/containers/syncmap.go
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 Luke Shumaker <lukeshu@lukeshu.com>
+// Copyright (C) 2022-2023 Luke Shumaker <lukeshu@lukeshu.com>
//
// SPDX-License-Identifier: GPL-2.0-or-later
@@ -18,6 +18,7 @@ func (m *SyncMap[K, V]) Delete(key K) {
func (m *SyncMap[K, V]) Load(key K) (value V, ok bool) {
_value, ok := m.inner.Load(key)
if ok {
+ //nolint:forcetypeassert // Typed wrapper around untyped lib.
value = _value.(V)
}
return value, ok
@@ -25,17 +26,20 @@ func (m *SyncMap[K, V]) Load(key K) (value V, ok bool) {
func (m *SyncMap[K, V]) LoadAndDelete(key K) (value V, loaded bool) {
_value, ok := m.inner.LoadAndDelete(key)
if ok {
+ //nolint:forcetypeassert // Typed wrapper around untyped lib.
value = _value.(V)
}
return value, ok
}
func (m *SyncMap[K, V]) LoadOrStore(key K, value V) (actual V, loaded bool) {
_actual, loaded := m.inner.LoadOrStore(key, value)
+ //nolint:forcetypeassert // Typed wrapper around untyped lib.
actual = _actual.(V)
return actual, loaded
}
func (m *SyncMap[K, V]) Range(f func(key K, value V) bool) {
m.inner.Range(func(key, value any) bool {
+ //nolint:forcetypeassert // Typed wrapper around untyped lib.
return f(key.(K), value.(V))
})
}