Skip to content

Instantly share code, notes, and snippets.

@thwd
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thwd/2b965b7912fea68b93d2 to your computer and use it in GitHub Desktop.
Save thwd/2b965b7912fea68b93d2 to your computer and use it in GitHub Desktop.
1996 repro
package main
import (
"reflect"
)
func foo() func(int) {
return nil
}
func main() {
i := reflect.TypeOf(foo).Out(0).In(0)
t := reflect.FuncOf([]reflect.Type{i}, nil, false)
v := reflect.MakeFunc(t, func(in []reflect.Value) []reflect.Value {
return nil
})
v.Interface().(func(int))(1)
}
@thwd
Copy link
Author

thwd commented Feb 14, 2015

panic: interface conversion: interface is func(int), not func(int)

goroutine 1 [running]:
main.main()
    /home/thomas/Go/repro.1996.go:21 +0x212
exit status 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment