On Mon, Dec 23, 2019 at 6:41 PM <ju...@sqreen.io> wrote: >> > But I cannot find any way of assigning a value to the function pointer `f` >> > even using the `unsafe` package. >> >> https://play.golang.org/p/qP5kuSCW6dO > > Thanks, unfortunately the asm shows that what gets into `f` is the stack > address of `f0` and not the address of the function:
Nothing unfortunate about it, that's a perfectly correct value. I mentioned before that you don't want a pointer to a function but a function value, that one is found in f0 in the example. However, the value of f0 is _not_ the function's code address. Go function values are a pointer to a variable length structure that supports the closes over variables of the function. -- 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/CAA40n-W3%3Dm-r%3DYQtnwbQOmyA31GegS4tu5Wqm4oi9s0Bh2QOgw%40mail.gmail.com.