Seeing 'plugin built with different version' errors with Go1.11 (but not with Go1.10)

97 views
Skip to first unread message

William Ivory

unread,
Sep 5, 2019, 12:48:01 PM9/5/19
to golang-nuts
Hi,

I've been using Go plugins with Go1.10, and after initial problems getting our build system to build using identical paths to avoid the dreaded 'plugin was built with a different version of package' error, it all settled down and was working well for 6 months or so.  We're now trying to switch to Go1.11, and the exact same code and Debian build rules now consistently produces the 'different version' error.  Is anyone aware of any changes between Go1.10 and Go1.11 that might explain this?

Thanks,

William

William Ivory

unread,
Sep 6, 2019, 3:41:00 AM9/6/19
to golang-nuts
To answer my own question, it turned out the problem was a change in behaviour in dh-golang (Debian helper for golang).  This changed the build flags used by the default (non-overridden) Go build behaviour to use '-all' with 'trimpath', which changed the file paths embedded in the compiled code.  As the plugins use an override to build (dh-golang doesn't allow for buildmode=plugin), this caused the paths for the exact same shared code to appear to be different, and the plugins wouldn't load.

I'd be interested if anyone can explain why the default Go behaviour is not to trim paths back to the root of GOPATH, given the problems this can cause with plugins.  To my mind, the current hashing algorithm used to check plugins have been built with the same version as the caller of the plugin is actually wrong, as it rejects plugins built with the same code as the caller of the plugin.  Using trimpath / all flags is a workaround, but no more than that.

Regards,

William
Reply all
Reply to author
Forward
0 new messages