cleanup: use present typeFrom variable to avoid another reflect.TypeOf call

This commit is contained in:
Jian Li 2021-12-02 14:59:02 +08:00
parent 0fe049cb93
commit d4f3b5a6d1

View File

@ -179,7 +179,7 @@ func (c *Converter) RegisterGeneratedUntypedConversionFunc(a, b interface{}, fn
func (c *Converter) RegisterIgnoredConversion(from, to interface{}) error {
typeFrom := reflect.TypeOf(from)
typeTo := reflect.TypeOf(to)
if reflect.TypeOf(from).Kind() != reflect.Ptr {
if typeFrom.Kind() != reflect.Ptr {
return fmt.Errorf("expected pointer arg for 'from' param 0, got: %v", typeFrom)
}
if typeTo.Kind() != reflect.Ptr {