V8022. A parameter is not used in a function or method.
The analyzer has detected a parameter that has never been used in the body of a function or method.
The example:
func cardHasLock(width int, // <=
height int,
xScale float64,
yScale float64) {
lockWidth := int(math.Round(float64(height) * xScale))
lockHeight := int(math.Round(float64(height) * yScale))
....
}
The height parameter is used both when initializing the lockHeight variable and for lockWidth, which is a typo. To initialize the lockWidth variable correctly, use the width parameter:
lockWidth := int(math.Round(float64(width) * xScale))
The analyzer treats an unused parameter as acceptable and does not issue a warning in the following cases:
- the function or method is used as a value (for example, as a callback), where external code requires the parameter;
- the function or method is exported and must preserve its parameter list for backward compatibility;
- a specific interface strictly defines the parameter list;
- the function or method declares the parameter as a blank identifier;
- the function or method has an empty or trivial body;
- none of the function or method parameters are used;
- the file contains multiple functions or methods with similar unused parameters.