-
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: build path contributes to types not equal #19233
Comments
That's an interesting failure. Can you provide a functioning reproduction? (In particular, including the definition of filter.Filter.) |
Thanks for your reply, :-) definition of filter.Filter
plugin go file
load plugin file
|
You can find code in this project https://github.com/fagongzi/gateway/tree/go18-plugin-support.
|
Wouldn't this be similar to #18827? Technically the filter package lives at two distinct paths (gateway project and other project containing plugin) and go doesn't necessarily know the difference. This problem exists for non plugin code where two libraries try to interact with each other using the same type from two different versions of a package (at different paths but equivalent contents). See #12432 |
Yes, @edaniels . You are right. Thanks very much |
I am having this same issue, though it manifests a little differently. We have a project: github.com/influxdata/telegraf, which is meant to run our plugins. Each plugin has one dependency: github.com/influxdata/telegraf This means that the plugins do not work unless they are built in the exact same GOPATH as the telegraf binary was built in. ie, if I built the /home/sparrc/go/src/github.com/influxdata/telegraf then build the plugins from a slightly different GOPATH (different home directory) on our CI system: # telegraf dependency in /home/ubuntu/go/src/github.com/influxdata/telegraf
/home/ubuntu/go/src/github.com/influxdata/telegraf-plugins I will get the following error:
This despite the fact that both |
The cause is the logic in func |
I believe this was fixed by http://golang.org/cl/63693. Please comment if you still see this at HEAD. (See also, #21373.) |
Late note: I found that the issue is addressed at #18827 A similar issue exists for builds with vendoring support. I've created a sample repository which contains the examples and my observations: https://github.com/alperkose/golangplugins I've run the example with go version The issue goes away if vendor folder is not used. |
This issue is reproducible in Go 1.11 with simple plugin usage scenario like the below. Directory structure
There's only one common dependency package(github.com/xxx/server/apis) between plugin and main program and the package belongs to server module as you can see the above directory structure. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?1.8
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/opt/lib/go-path"
GORACE=""
GOROOT="/opt/lib/go"
GOTOOLDIR="/opt/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build171911883=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
What did you do?
I want to use custom interface based on go plugin, but i found it's not support.
What did you expect to see?
I expect this operation will success.
What did you see instead?
panic: interface conversion: plugin.Symbol is func() (filter.Filter, error), not func() (filter.Filter, error)
The text was updated successfully, but these errors were encountered: