3 ms·
You could create a dummy interface which all your DoParams-like types could implement: type Params interface { IsParams() } Also, you can get away with pa
by groks 13y ago
You could create a dummy interface which all your DoParams-like types could implement:
type Params interface { IsParams() }
Also, you can get away with passing a nil pointer for reflection rather than allocating a nil struct:
fmt.Printf("nil pointer to DoParams: %T", (*DoParams)(nil))
fmt.Printf("pointer to nil DoParams: %T", &DoParams{})
(Which isn't going to be a source of gc pressure in this instance, but still...)