V012¶
ValidationStandard
check for custom SchemaValidateFunc that implement validation.IntAtLeast(), validation.IntAtMost(), or validation.IntBetween()
The V012 analyzer reports when custom SchemaValidateFunc declarations can be replaced with validation.IntAtLeast(), validation.IntAtMost(), or validation.IntBetween().
Examples¶
Ignoring reports¶
Singular reports can be ignored by adding a //lintignore:V012 Go code comment at the end of the offending line or on the line immediately preceding, e.g.
//lintignore:V012
func validateExampleThing(v interface{}, k string) (ws []string, errors []error) {
value := v.(int)
if value < 1 || value > 255 {
errors = append(errors, fmt.Errorf("%q must be between 1 and 255: %d", k, value))
}
return
}
This page is generated from passes/V012/README.md, which lives beside the analyzer.