<p dir="auto">Currently there is no way to retrieve function/method parameter names with the reflect package. The only introspection available is for the types of the input and output parameters of a function. The seems to be an exception with the reflect package, since it does offer naming information in most other cases.</p>
<p dir="auto">When building RPC/API libraries it is useful to be able to retrieve these method parameters names for purposes of runtime schema output, input validation on unstructured data, and possibly some API semantics. There are some alternatives right now:</p>
<ul dir="auto">
<li>Parse the source and use code generation to compile this metadata into the running program.</li>
<li>Use structs for all input/output and then use the field names in the structs, along with their tags, for introspection.</li>
</ul>
<p dir="auto">Some other considerations:</p>
<ul dir="auto">
<li>I understand that this might lead to binary and/or memory size increase due to the additional metadata that might have to be stored. This change might not be ideal this far into the 1.X cycle, but I think it should at least be considered for 2.0.</li>
<li>A fairly straightforward way to do this, that would not break backwards compatibility, would be to add two methods to reflect.Type that would retrieve the In/Out parameter names by Index.</li>
</ul>
<p dir="auto">Apologies if this is a duplicate issues. I searched the forums (nuts/dev) and this issue tracker and could not find any previous issues filed on this topic.</p>
<pre class="notranslate">I was hoping

// setInterfaceValue sets an interface value to a concrete value,
// but first it checks that the assignment will succeed.
func setInterfaceValue(ivalue reflect.Value, value reflect.Value) {
    if !value.Type().AssignableTo(ivalue.Type()) {
        errorf("cannot assign value of type %s to %s", value.Type(), ivalue.Type())
    }
    ivalue.Set(value)
}

Could be changed to 
errorf("%s is not assignable to type %s", value.Type(), ivalue.Type(),
value.Type(), ivalue.Type())

I feel that the documentation on gob could be improved, though from previous discussions
it sounds like there is disagreement on adding examples for interfaces. While perhaps
independently this error seems sufficient, I found it confusing in the set of errors I
encountered while trying to understand how to correctly use the interface encoding, and
I did not fully realize what that meant until I looked at the source to see
reflect.AssignableTo was being used. I feel like changing the wording in this way makes
it more clear that "assign" is being used like in the language of the spec,
and not in a less precise manner.</pre>