Hacker News new | ask | show | jobs
by groks 4602 days 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...)