Go enforces this rule to prevent dead code, reduce binary size, and catch copy-paste errors early. The compiler checks every import and variable declaration to ensure it is used at least once in the package. To silence the error for a variable you intentionally ignore, assign it to the blank identifier _.
Why Does Go Force You to Use Every Import and Variable
Go requires all imports and variables to be used to prevent dead code and errors, fixable by assigning unused values to the blank identifier.