Go Lang中reflect.MakeFunc的功能

Go Lang中reflect.MakeFunc的功能,go,Go,我收到一个错误:未定义的reflect.MakeFunc。。为什么会这样 package main import ( "fmt" "reflect" ) func main() { swap := func(in []reflect.Value) []reflect.Value { return []reflect.Value{in[1], in[0]} } makeSwap :=

我收到一个错误:未定义的reflect.MakeFunc。。为什么会这样

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(&intSwap)
        fmt.Println(intSwap(0, 1))
        var floatSwap func(float64, float64) (float64, float64)
        makeSwap(&floatSwap)
        fmt.Println(floatSwap(2.72, 3.14))
}

使用Go的发布版本: