Set configures a validator option with the given name and value. If the value had previously been set, the new value must have the same reflection type as the old one, or the call will error.
(name string, value any)
| 200 | // If the value had previously been set, the new value must have the same reflection type as the old one, |
| 201 | // or the call will error. |
| 202 | func (config *validatorConfig) Set(name string, value any) error { |
| 203 | v, found := config.data[name] |
| 204 | if found && reflect.TypeOf(v) != reflect.TypeOf(value) { |
| 205 | return fmt.Errorf("incompatible configuration type for %s, got %T, wanted %T", name, value, v) |
| 206 | } |
| 207 | config.data[name] = value |
| 208 | return nil |
| 209 | } |
| 210 | |
| 211 | // ExtendedValidations collects a set of common AST validations which reduce the likelihood of runtime errors. |
| 212 | // |
nothing calls this directly
no outgoing calls
no test coverage detected