diff options
author | Bjørn Erik Pedersen <[email protected]> | 2022-03-17 22:03:27 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2022-03-17 22:03:27 +0100 |
commit | b80853de90b10171155b8f3fde47d64ec7bfa0dd (patch) | |
tree | 435d3dbf7a495a0c6ce64c9769e037179aa0d27b /cache | |
parent | 423594e03a906ef4150f433666ff588b022c3c92 (diff) | |
download | hugo-b80853de90b10171155b8f3fde47d64ec7bfa0dd.tar.gz hugo-b80853de90b10171155b8f3fde47d64ec7bfa0dd.zip |
all: gofmt -w -r 'interface{} -> any' .
Updates #9687
Diffstat (limited to 'cache')
-rw-r--r-- | cache/namedmemcache/named_cache.go | 4 | ||||
-rw-r--r-- | cache/namedmemcache/named_cache_test.go | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/cache/namedmemcache/named_cache.go b/cache/namedmemcache/named_cache.go index 4e912bf58..7fb4fe8ed 100644 --- a/cache/namedmemcache/named_cache.go +++ b/cache/namedmemcache/named_cache.go @@ -30,7 +30,7 @@ type Cache struct { } type cacheEntry struct { - value interface{} + value any err error } @@ -55,7 +55,7 @@ func (c *Cache) Clear() { // create will be called and cached. // This method is thread safe. It also guarantees that the create func for a given // key is invoked only once for this cache. -func (c *Cache) GetOrCreate(key string, create func() (interface{}, error)) (interface{}, error) { +func (c *Cache) GetOrCreate(key string, create func() (any, error)) (any, error) { c.mu.RLock() entry, found := c.cache[key] c.mu.RUnlock() diff --git a/cache/namedmemcache/named_cache_test.go b/cache/namedmemcache/named_cache_test.go index 9feddb11f..2db923d76 100644 --- a/cache/namedmemcache/named_cache_test.go +++ b/cache/namedmemcache/named_cache_test.go @@ -28,7 +28,7 @@ func TestNamedCache(t *testing.T) { cache := New() counter := 0 - create := func() (interface{}, error) { + create := func() (any, error) { counter++ return counter, nil } @@ -58,8 +58,8 @@ func TestNamedCacheConcurrent(t *testing.T) { cache := New() - create := func(i int) func() (interface{}, error) { - return func() (interface{}, error) { + create := func(i int) func() (any, error) { + return func() (any, error) { return i, nil } } |