plugin: fails to correctly reference type from vendor #27062
Comments
Upon further inspection, it appears the reflection does not view the type |
It looks like the discussion from https://github.com/golang/proposal/blob/master/design/25719-go15vendor.md and the comment in Line 360 in 3acd257 Does anyone have a better method that I could use in my example to load the plugin with the custom type |
Recommendations:
|
My workaround for this bug, is to store the $ cat deps.sh
#!/bin/sh
unset IFS
set -euf
go get github.com/TykTechnologies/tyk
sh -c "cd $GOPATH/src/github.com/TykTechnologies/tyk && git checkout v2.9.4.3"
# Re-enable Tyk plugin feature
sh -c "cd $GOPATH/src/github.com/TykTechnologies/tyk && go install -a -tags 'goplugin'"
$ ./deps.sh This is not ideal for Windows, but it basically works in any UNIX environment, such as WSL. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.10.3 linux/amd64
Does this issue reproduce with the latest release?
yes, 1.10.3
What operating system and processor architecture are you using (
go env
)?What did you do?
When using plugins, in a typical github vendoring approach:
$GOPATH/src/github.com/author/repo/package
with resources in$GOPATH/src/github.com/author/repo/package/vendor/github.com/author/repoa/package
, if the plugin was compiled using a separate package, that is ultimately imported into the main package via vendoring, the types don't match and casting is not possible.This tree works (rooted at
$GOPATH/src/github.com
:This tree does not work (rooted at
$GOPATH/src/github.com
)In both the working and not working cases, the imports are the same, just the directory structure is different.
plbody.go:
pltypes.go:
plmain.go:
plplugin.go:
What did you expect to see?
What did you see instead?
The types are not castable to each other:
The text was updated successfully, but these errors were encountered: