From 6899b2efa06e6db3b080f3573113bced73269a52 Mon Sep 17 00:00:00 2001 From: jedarden Date: Fri, 24 Apr 2026 07:33:28 -0400 Subject: [PATCH] fix(bots): fix gatherer Go compile error - declare nearestEnergy in function scope The nearestEnergy variable was referenced inside findNearestEnergy() but only declared in the caller's scope. Declare it locally and use _ in caller. Co-Authored-By: Claude Sonnet 4.6 --- bots/gatherer/strategy.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bots/gatherer/strategy.go b/bots/gatherer/strategy.go index 48ea20d..c8e6965 100644 --- a/bots/gatherer/strategy.go +++ b/bots/gatherer/strategy.go @@ -84,7 +84,7 @@ func (s *GathererStrategy) computeBotMove( } // Try to find nearest untargeted energy - nearestEnergy, path := s.findNearestEnergy(bot.Position, energyPositions, usedEnergy, enemyPositions, config) + _, path := s.findNearestEnergy(bot.Position, energyPositions, usedEnergy, enemyPositions, config) if path != nil && len(path) > 0 { // Move towards the energy return &Move{ @@ -156,7 +156,7 @@ func (s *GathererStrategy) findNearestEnergy( queue := list.New() queue.PushBack(queueItem{pos: start, path: []Direction{}}) - _ = nearestEnergy // Track found position (unused but semantically meaningful) + var nearestEnergy Position var bestPath []Direction for queue.Len() > 0 {