|| at Oct 19, 2015 at 12:54 am
Thanks for the quick response. Not worth going into the details, I just
wanted to confirm what I thought I already knew (I've got a few 100k lines
of Go behind me, but I'm always surprised by something I didn't know which
is really rewarding, the Func stuff in the runtime for example). In this
real corner case, would have been nice, but its not the only way to skin
On Sun, Oct 18, 2015 at 5:45 PM, Jesse McNelis wrote:
On Mon, Oct 19, 2015 at 11:20 AM, John wrote:
I'm doing something a little cooky and I'm hoping I might just be missing
something in the reflect/runtime package.
I'm looking for a way to extract the value of a variable's arguments, if the
variable is a function type. So if I had:
var x = func("hello")
I want to extract blah's 0 argument value, "hello".
I can see how to get the type of the value using reflect.TypeOf(x).In(0),
but can't see a way to get the value.
I'm assuming that there isn't, but figured I'd ask before I moved onto
another method for what I'm doing.
Yes, there is no way to do this.
You can only do reflect on values and someFunc("hello") isn't a value,
it's an expression.
Perhaps if you told us why your want to do this we might be able to
suggest a better way of achieving your goal.
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 email@example.com.
For more options, visit https://groups.google.com/d/optout.