Thanks. On Monday, November 1, 2021 at 8:56:38 PM UTC+5:30 Brian Candler wrote:
> On Monday, 1 November 2021 at 13:44:28 UTC chauhan...@gmail.com wrote: > >> greeter.go calls plugin.open and it will be work only for one sub version >> of go. If plugin and binary are made in different sub versions of go1.15 >> then plugin.open will not work. >> >> > That is correct, that is how it is designed. Quoting from the link I > posted before > <https://www.reddit.com/r/golang/comments/b6h8qq/is_anyone_actually_using_go_plugins/ejkxd2k/?utm_source=reddit&utm_medium=web2x&context=3> > : > > > - > > The plugin compiler version must exactly match the program's compiler > version. If the program was compiled with 1.11.4, it won't work to compile > the plugin with 1.11.5. When distributing a program binary, you must > communicate what the compiler version you used is. > - > > Any packages outside of the standard library that are used by both the > plugin and the program must have their versions match *exactly*. This > means that when distributing a program binary, you must communicate the > exact versions of all dependencies > > and: > > "It seems that the intended use-case for plugins is *in-tree* plugins; > when you have code you don't want to always include in the main binary, but > you have no problem with it living in the same git repo and getting > compiled at the same time. It does *not* seem to be a good way to let > users/customers add in their own code; there are headaches if you try to > use them that way; they have to sufficiently emulate your environment when > compiling the plugin" > > If you want a more generic way to do "plugin" type functionality, which is > less tightly coupled, then I suggest you look at talking gRPC over a > socket. There is a go-plugin library > <https://github.com/hashicorp/go-plugin> for this from Hashicorp, which > they use in Vault <https://www.vaultproject.io/docs/internals/plugins> > etc. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/87454d55-193b-47c2-b46a-240178c17ca5n%40googlegroups.com.