mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-03 10:31:59 +00:00
all: use any instead of interface{}
My favorite part of generics. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
This commit is contained in:
committed by
Josh Bleecher Snyder
parent
5f176f24db
commit
0868329936
@@ -113,11 +113,11 @@ func (h *hasher) sum() (s Sum) {
|
||||
}
|
||||
|
||||
var hasherPool = &sync.Pool{
|
||||
New: func() interface{} { return new(hasher) },
|
||||
New: func() any { return new(hasher) },
|
||||
}
|
||||
|
||||
// Hash returns the hash of v.
|
||||
func Hash(v interface{}) (s Sum) {
|
||||
func Hash(v any) (s Sum) {
|
||||
h := hasherPool.Get().(*hasher)
|
||||
defer hasherPool.Put(h)
|
||||
h.reset()
|
||||
@@ -130,7 +130,7 @@ func Hash(v interface{}) (s Sum) {
|
||||
}
|
||||
|
||||
// Update sets last to the hash of v and reports whether its value changed.
|
||||
func Update(last *Sum, v ...interface{}) (changed bool) {
|
||||
func Update(last *Sum, v ...any) (changed bool) {
|
||||
sum := Hash(v)
|
||||
if sum == *last {
|
||||
// unchanged.
|
||||
@@ -304,7 +304,7 @@ type mapHasher struct {
|
||||
}
|
||||
|
||||
var mapHasherPool = &sync.Pool{
|
||||
New: func() interface{} { return new(mapHasher) },
|
||||
New: func() any { return new(mapHasher) },
|
||||
}
|
||||
|
||||
type valueCache map[reflect.Type]reflect.Value
|
||||
|
||||
Reference in New Issue
Block a user