Go: reflect : Call with too few input arguments
<p>I've stucked with problems of using reflect library. I descided to use it because of many recomendations, but i'm just learning go and some parts are not really easy..</p>

<p>I've got this part of code : </p>

<pre><code> func countDataByName(sourceName string, statData interface{}, filters Filter, chartName string) []ChartElement {
            ...
    //step 1 - filter
    filteredData := reflect.ValueOf(statData).MethodByName("FilterData").Call([]reflect.Value{})

    //step 2 - cluster
    //  clusterData := reflect.ValueOf(filteredData).MethodByName("clusterData").Call([]reflect.Value{})

    //step 3 - count
    //  countedData := reflect.ValueOf(clusterData).MethodByName(chartName).Call([]reflect.Value{})

    fmt.Println("Never prints to anywhere", filteredData)

            ...
     return filterData
 }
</code></pre>

<p>If I execute the method like this, I get error : <code>reflect: Call with too few input arguments</code>. But if I change <code>reflect.ValueOf(statData)</code> on <code>reflect.ValueOf(&amp;statData)</code> than error is <code>reflect: call of reflect.Value.Call on zero Value</code></p>

<p><code>statData</code> comes with one of 2 types, and fore this types I have structs and methods, like this : </p>

<pre><code>type NoaggModel struct {
    Date             string
    Hour             int
    Id_user          int
    Id_line          int
    Id_region        int
    Id_tree_devision int
    N_inb            int
    N_inb_d          int
    T_ring           int
    T_inb            int
    T_inb_d          int
    T_hold           int
    T_acw            int
    T_acw_d          int
    T_wait           int
}

func (ng *NoaggModel) FilterData( data NoaggModel) {
    fmt.Println("FilterData")
    fmt.Println("data : ", data)
}
</code></pre>

<p>this Println also not works. Code panics above , and method was not triggered. Where is my mistake here? </p>

<p><strong><em>Upd 1:</em></strong></p>

<p>Found that if I remove param <code>data</code> in functioin that I want to call, than it calls nicely. But! 
I have <code>statData</code> as 1 row, of structs, so type is <code>NoaggModel</code>. And in the method <code>FilterData</code> I get this 1 row as <code>ng</code>. But I need to change it to the <code>[]NoaggModel</code>. How to call <code>reflect</code> in this case and how to pass parameter to the filter function ? </p>

<p><strong><em>Upd 2:</em></strong>
I modified few parts : </p>

<pre><code>func (ng *NoaggModel) FilterData(filter interface{}, data NoaggModel) {
    fmt.Println("data : ",ng)
}
</code></pre>

<p>In here, how to pass correct type to <code>filter</code>, if it is set up in revel controller, and method is in model. Or should I set the type in each model and call it in controller? </p>

<p>And in controller I wrote : </p>

<pre><code>//step 1 - filter
    in := make([]reflect.Value, 2)

    in[0] = reflect.ValueOf(filters)
    in[1] = reflect.ValueOf(statData)

    filteredData := reflect.ValueOf(statData).MethodByName("FilterData").Call(in)
</code></pre>

<p><code>StatData</code> is a row of type NoaggModel, but I get the error : </p>

<pre><code> reflect: Call using *models.NoaggModel as type models.NoaggModel 
</code></pre>

<p>The type was set also by <code>reflect</code> in code above, like this : </p>

<pre><code>    ...
    var sourceTypes = map[string]reflect.Type{
        "noagg": reflect.TypeOf(models.NoaggModel{}),
        "oracle": reflect.TypeOf(models.OracleModel{}),
    }
    deserializedData = reflect.New(sourceTypes[sourceName]).Interface()
    ...
    // deserialised becomes statData
</code></pre>