Has anyone had any success using plugins across repositories using Go 
modules?

I have two github repositories; one uses plugins (USER), the other contains 
a plugin (USED).  I have a tag on a commit in the USER repo, and the go.mod 
in the USED repo references that version.  Both go.mod files reference the 
same Go version.

If I modify the USED go.mod to include a replace rule for the USED 
repository so that it's pointing to a relative clone, the module works 
fine.  If I try to build both from the remote source, it does not.  I'm 
trying to figure out if there's a step I'm missing, or if this isn't yet 
possible.  The error I get is the usual:

plugin was built with a different version of package 
github.com/xxxserxxx/gotop/v3/devices

Steps I'm using (that fail -- this won't work right now because I've made 
commits past the tagged version)

   1. go get -u github.com/xxxserxxx/gotop/cmd/gotop
   2. go build --buildmode=plugin -o dummy.so .
   3. Also: git checkout v3.4.3 && go build -o gotop ./cmd/gotop produces 
   binaries that are not compatible with the previous step.  This, I'd expect 
   to work as they're the exact same tagged versions.
   
Step 1 is run outside of the plugin directory, to avoid any issues with go 
get unnecessarily modifying the cwd go.mod

I've also run go clean -i -r -x -cache -modcache in $HOME and both clones 
to (try to) ensure there's no accidental grabbing of the wrong version.

I do understand the caveats about the early and non-production-ready status 
of plugins.  I'd love to hear if anybody is building using go modules 
directly from a github repository successfully, and what they're doing to 
make it work.

Thank you


TMI:

   - Main using plugins: https://github.com/xxxserxxx/gotop
   - Plugin: https://github.com/xxxserxxx/gotop-dummy

Main go.mod:

module github.com/xxxserxxx/gotop/v3

require (
  // SNIPPED for brevity-- there are no shared referenced dependencies
)

go 1.14


dummy go.mod (in its entirety):

module github.com/xxxserxxx/gotop-dummy

require github.com/xxxserxxx/gotop/v3 v3.4.3

go 1.14


-- 
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/afdb2c0f-881b-46db-bd38-37d3748c484c%40googlegroups.com.

Reply via email to