Go is a simple language. Code in Go does what it says. No magic.
That is its beauty. That is its power. On Sunday, 12 April 2020 03:59:08 UTC+1, Tanmay Das wrote: > > Say you have a struct Foo and you access fields and call methods on it as > you normally would. But is it possible to execute a hook before or after > that field access or method call? A good scenario will be: > > The user calls non-existent method foo.Bar() or accesses non-existent > field foo.Bar. If they don't exist, I want to: > a) In case of a method call: forward that call to foo.Baz() > b) In case of field access: set the foo.Bar at runtime with some value > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/c49365b1-bf56-46e4-af8c-ef9667febb2a%40googlegroups.com.