You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After fixing the plugin.open function to take the basename
of the path (otherwise it seems you can't load the plugin from
an absolute path), this prints:
later called
earlier called
x0 "later compile (later)" bar.T
x1 "later compile (earlier)" bar.T
Note that the plugin has called the constructor from within the plugin
code, but the String method is called from within the package that
was current when plugin loader was compiled.
This seems potentially problematic - we could have a constructor and
a method that maintain an invariant between them, and this could result
in subtly (or blatantly!) broken code.
It seems odd to me that there are two versions of the same
function lurking around - isn't plugin loading meant to de-dupe
packages?
The text was updated successfully, but these errors were encountered:
The plugin package should refuse to load a plugin where a common package varies in any way. (Same with the toolchain used to build the binary and host plugin.) There is machinery used by -buildmode=shared that I believe can be adopted to do this.
go version devel +2113c9a Tue Oct 25 07:51:17 2016 +0000 linux/amd64
I installed a package local/bar:
Then I built this code in package local/foo in plugin mode
(note that I wanted to export func() interface{} but couldn't
because of issue 17140):
Then I changed the local/bar package to change all occurrences of
"earlier" to "later" and installed it again.
Then I ran this program:
After fixing the plugin.open function to take the basename
of the path (otherwise it seems you can't load the plugin from
an absolute path), this prints:
Note that the plugin has called the constructor from within the plugin
code, but the String method is called from within the package that
was current when plugin loader was compiled.
This seems potentially problematic - we could have a constructor and
a method that maintain an invariant between them, and this could result
in subtly (or blatantly!) broken code.
It seems odd to me that there are two versions of the same
function lurking around - isn't plugin loading meant to de-dupe
packages?
The text was updated successfully, but these errors were encountered: