From 23ec3c104a91780c3d184bece59520ff14b965e2 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Mon, 15 Aug 2022 22:36:08 -0700 Subject: [PATCH] util/deephash: remove unused stack slice in typeIsRecursive (#5363) No operation ever reads from this variable. Signed-off-by: Joe Tsai --- util/deephash/deephash.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/util/deephash/deephash.go b/util/deephash/deephash.go index 27d3a6b77..f259a5e04 100644 --- a/util/deephash/deephash.go +++ b/util/deephash/deephash.go @@ -646,8 +646,6 @@ func getTypeInfoLocked(t reflect.Type, incomplete map[reflect.Type]*typeInfo) *t func typeIsRecursive(t reflect.Type) bool { inStack := map[reflect.Type]bool{} - var stack []reflect.Type - var visitType func(t reflect.Type) (isRecursiveSoFar bool) visitType = func(t reflect.Type) (isRecursiveSoFar bool) { switch t.Kind() { @@ -678,11 +676,9 @@ func typeIsRecursive(t reflect.Type) bool { if inStack[t] { return true } - stack = append(stack, t) inStack[t] = true defer func() { delete(inStack, t) - stack = stack[:len(stack)-1] }() switch t.Kind() {