Description\n\nThe hasOverlappingComment comment-preservation guard is currently implemented inline inside mapclearloop analyzer but is missing from mapdeletecheck (tracked in #46130). Both are block/statement-replacing autofixers that should protect comments from being silently dropped.\n\nThe Sergo R62 audit (2026-07-18) explicitly recommends extracting this guard to internal/astutil to eliminate duplication and enable consistent comment-safety across all SuggestedFix autofixers.\n\n## Suggested Changes\n\n1. Create pkg/linters/internal/astutil/comments.go with an exported HasOverlappingComment helper\n2. Replace the inline implementation in mapclearloop with a call to the shared helper\n3. Add the guard to mapdeletecheck via the shared helper (resolves #46130)\n4. Add unit tests for the shared helper\n\n## Files Affected\n\n- pkg/linters/mapclearloop.go (extract inline guard)\n- pkg/linters/mapdeletecheck.go (add missing guard)\n- pkg/linters/internal/astutil/comments.go (new file)\n\n## Success Criteria\n\n- hasOverlappingComment logic exists in exactly one place\n- Both mapclearloop and mapdeletecheck use the shared helper\n- All existing linter tests pass\n- make golint-custom remains clean\n\n## Source\n\nExtracted from Sergo Report #46342 (2026-07-18), R62 next-steps section.\n\n## Priority\n\nMedium — prevents comment loss in autofixes and reduces duplication.
🔍 Task mining by Discussion Task Miner - Code Quality Improvement Agent · 75.7 AIC · ⌖ 7.67 AIC · ⊞ 7K · ◷
Description\n\nThe
hasOverlappingCommentcomment-preservation guard is currently implemented inline insidemapclearloopanalyzer but is missing frommapdeletecheck(tracked in #46130). Both are block/statement-replacing autofixers that should protect comments from being silently dropped.\n\nThe Sergo R62 audit (2026-07-18) explicitly recommends extracting this guard tointernal/astutilto eliminate duplication and enable consistent comment-safety across all SuggestedFix autofixers.\n\n## Suggested Changes\n\n1. Createpkg/linters/internal/astutil/comments.gowith an exportedHasOverlappingCommenthelper\n2. Replace the inline implementation inmapclearloopwith a call to the shared helper\n3. Add the guard tomapdeletecheckvia the shared helper (resolves #46130)\n4. Add unit tests for the shared helper\n\n## Files Affected\n\n-pkg/linters/mapclearloop.go(extract inline guard)\n-pkg/linters/mapdeletecheck.go(add missing guard)\n-pkg/linters/internal/astutil/comments.go(new file)\n\n## Success Criteria\n\n-hasOverlappingCommentlogic exists in exactly one place\n- Bothmapclearloopandmapdeletecheckuse the shared helper\n- All existing linter tests pass\n-make golint-customremains clean\n\n## Source\n\nExtracted from Sergo Report #46342 (2026-07-18), R62 next-steps section.\n\n## Priority\n\nMedium — prevents comment loss in autofixes and reduces duplication.