<p>I'm working on a forum in Go and while things are going pretty well so far, I'd like to set up some kind of plugin system using Python, Lua, or Javascript to make it easier for others who aren't familiar with Go to contribute. What would you guys recommend, taking into consideration flexibility and ideally low overhead?</p>
<hr/>**评论:**<br/><br/>natefinch: <pre><p>Take a look at <a href="https://github.com/natefinch/pie" rel="nofollow">https://github.com/natefinch/pie</a> - it supports plugins in any language as long as they support JSON RPC. </p>
<p>Though Lua is a pretty good solution too. </p></pre>ChristophBerger: <pre><p>There have been many different approaches to implementing plugins in Go, from talking to external processes via stdin/stdout (as the already mentioned <a href="https://github.com/natefinch/pie" rel="nofollow">pie</a>, or <a href="https://github.com/hashicorp/go-plugin" rel="nofollow">go-plugin</a>, or messaging systems like <a href="https://github.com/go-mangos/mangos" rel="nofollow">Mangos</a>, to complete scripting language subsystems, like <a href="https://github.com/yuin/gopher-lua" rel="nofollow">GopherLua</a>, <a href="https://github.com/robertkrimen/otto" rel="nofollow">Otto</a> (Javascript), or <a href="https://github.com/PuerkitoBio/agora" rel="nofollow">Agora</a>.</p>
<p>I wrote a round-up of these approaches (plus a tiny demo implementation using RPC) some time ago (especially, at a time before Go got its own <a href="https://golang.org/pkg/plugin/" rel="nofollow">plugin system</a> on Linux) in <a href="https://appliedgo.net/plugins/" rel="nofollow">this blog article</a>.</p></pre>eggbertx: <pre><p>I...somehow didn't know about the plugin system.</p></pre>ChristophBerger: <pre><p>Perhaps because it is not fully supported across platforms yet. Certainly it would have been more prominently announced (and more widely used and written about) if it came with support for macOS and Windows in 1.8.
Let's see what 1.9 brings...</p></pre>captncraig: <pre><p>It has a slew of other things going against it too. Can't unload plugins. Requires exact same version of all packages in common between host and plugin.</p>
<p>I honestly can't see very many use cases that don't devolve into really painful scenarios once either side needs to update pretty much anything.</p></pre>
