advance magic in go?

polaris · · 416 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>I like Go due to its simplicity and explicit, which making me wonder if there any magic (some sort of advance trick) similar to Java&#39;s reflection or bytecode manipulation.</p> <hr/>**评论:**<br/><br/>driusan: <pre><p>I&#39;m not sure what you&#39;re looking for exactly, but Go has its own reflect package:</p> <p><a href="https://golang.org/pkg/reflect/" rel="nofollow">https://golang.org/pkg/reflect/</a></p></pre>drabiter: <pre><p>Didn&#39;t know it exists before, seems pretty much powerful.</p></pre>HectorJ: <pre><p>Also see <a href="https://golang.org/pkg/unsafe/#Pointer" rel="nofollow">https://golang.org/pkg/unsafe/#Pointer</a></p></pre>letsencrypt: <pre><p>You can always use <a href="https://golang.org/pkg/unsafe/" rel="nofollow">unsafe</a> to do all the ✨magic✨ you want.<br/> EDIT: Or <a href="https://golang.org/cmd/cgo/" rel="nofollow">cgo</a> but maybe I&#39;m misunderstanding your intentions.</p></pre>Astrus: <pre><p>I like doing magic in Go: <a href="https://github.com/lukechampine/freeze" rel="nofollow">https://github.com/lukechampine/freeze</a></p></pre>drabiter: <pre><p>this one is interesting, thanks</p></pre>k_u_r_o_k_u_s_e: <pre><p>Go has extensive reflection capabilities, it&#39;s difficult to use but it&#39;s there.</p> <p>There is no bytecode manipulation, there are unsafe pointers but I wouldn&#39;t use them.</p></pre>drvd: <pre><p>There is no magic in Touring complete languages.</p></pre>ChristophBerger: <pre><p>Magic is in the eye of the beholder.</p></pre>

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

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