3 ms·
Yeah, you can look up a method but only if you already have the receiver’s type (which you also can’t look up by name, or by listing a package).
by erik_seaberg 3y ago
Yeah, you can look up a method but only if you already have the receiver’s type (which you also can’t look up by name, or by listing a package).
- zimpenfish 3y agoYou don't need the receiver's type because you're calling `MethodByName` on a `reflect.Value` which you can construct from any receiver. https://go.dev/play/p/hg-ugl7i0ei https://go.dev/play/p/hg-ugl7i0ei demonstrates this, I think?