panic: interface conversion: ... (types from different scopes)

673 views
Skip to first unread message

clement...@gmail.com

unread,
Feb 8, 2019, 9:11:47 AM2/8/19
to golang-nuts
Hello

i was playing with the plugin mode and i met this error

panic: interface conversion: interface {} is func(string, func([]string) error) error, not func(string, func([]string) error) error (types from different scopes)

the code is a regular conversion, without test because i was not expecting such failure, something like x := arg.(func(...))

as https://github.com/golang/go/issues/26094 i understand that i declared a type with identical signature but within two different programming scopes.

i was working with go1.11 when i got that error specifically.
go1.10 is also having this behavior, the error is a bit less expressive.

the binary file was build with go build .... -buildmode=plugin ...
the program does not break during the plugin loading sequence,
it breaks later at runtime with a panic as demonstrated.

its unmanageable behavior for me, i have no way to overcome that error,
i wonder if there is anyway i can dynamically load generated code,
i wonder if this behavior is intended to remain forever.

thank you

yy0...@connect.hku.hk

unread,
Mar 12, 2020, 1:39:33 PM3/12/20
to golang-nuts
Just encountered the same problem. Would you mind sharing how you solved it? Thanks a lot.
Reply all
Reply to author
Forward
0 new messages