We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
go version
go version go1.8.1 linux/amd64
go env
GOARCH="amd64" GOBIN="" GOEXE="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOOS="linux" GOPATH="/go" GORACE="" GOROOT="/usr/local/go" GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64" GCCGO="gccgo" CC="gcc" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build326475474=/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"
main.go
package main import "plugin" import "fmt" func main() { aPlug, _ := plugin.Open("a.so") aSymPlug, _ := aPlug.Lookup("Rule") fmt.Printf("Plugin: %v loaded\n", aSymPlug) bPlug, _ := plugin.Open("b.so") bSymPlug, _ := bPlug.Lookup("Rule") fmt.Printf("Plugin: %v loaded\n", bSymPlug) }
a.go plugin
package main type plugin string func init() { Rule = "a" } func (p plugin) String() string { return "a" } var Rule plugin
b.go plugin
package main type plugin string func init() { Rule = "b" } func (p plugin) String() string { return "b" } var Rule plugin
Output:
Plugin: a loaded Plugin: b loaded
Plugin: a loaded Plugin: a loaded
Note if I change the return value for String() method to string(p) then everything works as expected.
String()
string(p)
The text was updated successfully, but these errors were encountered:
/cc @crawshaw
Sorry, something went wrong.
Rename type to avoid collission
c0305b9
golang/go#20376
This is a variant of #21386, and I believe is fixed by https://golang.org/cl/60910 (605331f).
No branches or pull requests
What version of Go are you using (
go version
)?go version go1.8.1 linux/amd64
What operating system and processor architecture are you using (
go env
)?What did you do?
main.go
a.go plugin
b.go plugin
What did you expect to see?
Output:
What did you see instead?
Output:
Note if I change the return value for
String()
method tostring(p)
then everything works as expected.The text was updated successfully, but these errors were encountered: