<p>Does anyone have any sample code for using go generate on a struct to make something? For example go generate on a struct to add a stringer method.</p>
<hr/>**评论:**<br/><br/>tucnak: <pre><p>You are probably LF this: <a href="https://godoc.org/golang.org/x/tools/cmd/stringer" rel="nofollow">https://godoc.org/golang.org/x/tools/cmd/stringer</a></p></pre>twek: <pre><p>I ended up just playing with the parser package, here is what I ended up with not sure if its helpful to anyone but its pretty simple</p>
<p><a href="https://play.golang.org/p/nTwJ7pL_k-" rel="nofollow">https://play.golang.org/p/nTwJ7pL_k-</a></p>
<p>edit: s/her/here/g</p></pre>taw9: <pre><p><a href="https://github.com/tristanwietsma/tabler" rel="nofollow">https://github.com/tristanwietsma/tabler</a></p>
<p>Wrote it a while ago for a proof of concept.</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传