Closed CAFxX closed 2 years ago
Note that there is also a HasMethod
predicate, that is a little bit more than Implements
.
Implements may not do what you want due to the pointer/value receivers.
HasMethod
checks whether you could write x.Method()
instead of checking that x
implements an interface that has such a method.
For example, see: https://github.com/quasilyte/go-perfguard/blob/c6dfda39b09493689d4c6abaee32b534739603c1/perfguard/_rules/universal_rules.go#L606
Thanks, fixed
https://gophers.slack.com/archives/C0VP8EF3R/p1660009225875149?thread_ts=1659978423.750169&cid=C0VP8EF3R