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:
Steps I'm using (that fail -- this won't work right now because I've made commits past the tagged version)
- go get -u github.com/xxxserxxx/gotop/cmd/gotop
- go build --buildmode=plugin -o dummy.so .
- 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 go.mod:
dummy go.mod (in its entirety):