title: Functioning of reflect.MakeFunc in Go-Lang
body: <p>I am getting an error: undefined reflect.MakeFunc.. Why so?</p>
  
  <pre><code>package main
  
  import (
          "fmt"
          "reflect"
  )
  
  func main() {
          swap := func(in []reflect.Value) []reflect.Value {
                  return []reflect.Value{in[1], in[0]}
          }
          makeSwap := func(fptr interface{}) {
                  fn := reflect.ValueOf(fptr).Elem()
                  fn.Set(reflect.MakeFunc(fn.Type(), swap))
          }
          var intSwap func(int, int) (int, int)
          makeSwap(&amp;intSwap)
          fmt.Println(intSwap(0, 1))
          var floatSwap func(float64, float64) (float64, float64)
          makeSwap(&amp;floatSwap)
          fmt.Println(floatSwap(2.72, 3.14))
  }
  </code></pre>