From 15c74c8a5df18d0acf911487805a94eebad003cb Mon Sep 17 00:00:00 2001 From: Darragh O'Reilly Date: Mon, 10 Mar 2025 16:49:22 +0000 Subject: [PATCH] Fix shadowed variable in hash.go The entry variable is redeclared inside an if block and later sometimes set to nil within the block which has no effect on the entry variable in the outer block. Later in the outer block there is a comparison with nil which is always true. Fix by just assigning it in the inner block. Actually this makes no functional difference, but fixes a linter warning. --- vql/functions/hash.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vql/functions/hash.go b/vql/functions/hash.go index 0cc48d4dc..420957c06 100644 --- a/vql/functions/hash.go +++ b/vql/functions/hash.go @@ -202,7 +202,8 @@ func (self *HashFunction) Call(ctx context.Context, if useCache { cache = GetHashResultCache(scope) - entry, isCached := cache.Get(path) + var isCached bool + entry, isCached = cache.Get(path) if isCached { isValid, _ := entry.Validate(path) if isValid {