Plugin like architecture with new buildmodes

polaris · · 535 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>With the introduction of the new <a href="https://golang.org/cmd/go/#hdr-Description_of_build_modes">build modes</a> shouldn&#39;t it be possible to create some kind of plugin architecture for go programs.</p> <p>For example: One main binaries that scans a directory with contain multiple binaries that are loaded during run time and can be called during run time as long as they implement predefinded interfaces?</p> <hr/>**评论:**<br/><br/>joeshaw: <pre><p>There&#39;s no mechanism yet to programmatically load shared objects at runtime. That&#39;s the purpose of the &#34;plugin&#34; build mode (see <a href="https://golang.org/s/execmodes">https://golang.org/s/execmodes</a>), but it wasn&#39;t done for Go 1.5.</p></pre>TheMerovius: <pre><p>Not really. You want both the main program and the plugins to share the same runtime and compiler-generated type info (for interfaces to work). Afaik that is not currently the case. So you would still need to treat the plugins as basically a separate process and wrap it to transfer type info and so on. And you can already do that now (just with separate processes).</p> <p>I might be wrong, though.</p></pre>synalx: <pre><p>In theory, it&#39;s possible. In practice it&#39;d probably be too clunky to use effectively.</p></pre>IntellectualReserve: <pre><p>I&#39;ve thought about how cool this would be for zero downtime http servers. You could load new route handlers, and all of the current requests would finish executing under the old handlers while new requests would go through the newly loaded handlers. </p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

535 次点击  
加入收藏 微博
0 回复
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传