-
Notifications
You must be signed in to change notification settings - Fork 17.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
plugin: same type but not equal in unit tests #22505
Comments
I tried to follow your reproduction instructions. In order to build the plugin I had to add Please show us the exact commands that you type and the exact output that you get. Thanks. |
CC @crawshaw |
@ianlancetaylor Thanks for your attention. I think you had compiled master branch of the project. I've simplified the code and put them on a branch named |
Please show us the exact commands that you type and the exact output that you get. Thanks. |
Sorry, I don't describe the problem clearly. Now I record all command and output step by step.
Here is all output:
|
Change your test file to be like this https://pastebin.com/3TuSkHVQ terago/plugin imports terago and the test file is in package terago. Building the plugin will not include the test file therefore the packages are different on compile time. Changing the test file to be in package terago_test makes it a different package and therefore makes terago the same package when compiling the plugin and test. |
@AlexRouSg Thank you. You are right. Now the unit test is passed. |
Sounds like this is fixed, more or less. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?1.9.2
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?What did you do?
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
Maybe similar with #19233, but still reproducing in my env.
Here(https://github.com/opera/terago/tree/plugin_test) is an simplest reproducing env.
Program(plugin_test) and unit test (plugin_test.go) have same code.
go build -buildmode plugin plugin/terago.go
to genterago.so
go build -o plugin_example examples/plugin.go
to compileplugin_example
and this program can run correctly.go test -v plugin_test.go interface.go
to run unit test. Here will get a failure as follow:What did you expect to see?
run unit test correctly
What did you see instead?
running error, type assert error
interface conversion: plugin.Symbol is func(string, string) (terago.ClientI, error), not func(string, string) (terago.ClientI, error)
The text was updated successfully, but these errors were encountered: