Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: gate transformers on valid non-nil destinations
This builds on #203 which attempted to provide a more flexible gating to running transformers. However upon testing #203 in my own environment, I ran into the first panic listed below. There are a variety of errors that can happen when trying to run reflection on zero values: 2 just from my testing of this PR ``` panic: reflect: call of reflect.Value.Type on zero Value panic: reflect: call of reflect.Value.FieldByName on zero Value ``` The panic specifically calls out zero values, but it's actual a more specific set of values which is covered by `reflect.IsValid`. I attempted to replace the check with `reflect.IsZero`, which ends up being too restrictive and breaks existing tests. I also attempted to solely use `reflect.IsZero` which is not restrictive enough and cause the later panic above in the tests. Thus I arrived on the combination in this PR which seems to strike the "right" balance.
- Loading branch information