I appreciate something like this is best served in the compiler, but would it not be possible to build your own function that provides this functionality?
Sorta impossible. You can't suck values out of the current context, even with reflection. You always would need to pass values into a function, in which case you might as well use fmt.