<p><a href="https://github.com/project-empower/randomart-image" rel="nofollow">https://github.com/project-empower/randomart-image</a></p>
<p>It's a first stab at anything Go. I'm from C++. Would like a kind hearted soul to tell me how horrible it is...constructively :p</p>
<p>Edit: Thanks for the input! I applied corrections based on input, including gomalinter</p>
<hr/>**评论:**<br/><br/>jehaby: <pre><p>You might want to take a look at <a href="https://github.com/alecthomas/gometalinter" rel="nofollow">https://github.com/alecthomas/gometalinter</a></p></pre>Crazy__Eddie: <pre><p>This is great! Thanks!</p></pre>tclineks: <pre><p>Looks pretty good but there are some things to improve:</p>
<ul>
<li>snake case is not idiomatic for function names</li>
<li>you aren't checking <a href="https://godoc.org/bufio#Scanner.Err" rel="nofollow">https://godoc.org/bufio#Scanner.Err</a></li>
<li>the use of a channel for the scanner is IMO suspect</li>
<li>you're not returning a non-zero exit code on line 70</li>
<li>you're ignoring the possible error from png.Encode (errcheck linter should tell you this)</li>
<li>it looks like the code hasn't been run through gofmt/goimports (some whitespace oddities)</li>
<li>you have some commented out code in there</li>
<li>the output filename should be a parameter (and probably default to stdout -- <a href="https://godoc.org/github.com/campoy/tools/imgcat" rel="nofollow">https://godoc.org/github.com/campoy/tools/imgcat</a> could be a fun addition!)</li>
</ul>
<p>that's a mix of idiom, error handling, tooling, and style nits -- I hope helpful and gently enough delivered! Welcome to go!</p></pre>Crazy__Eddie: <pre><blockquote>
<p>the use of a channel for the scanner is IMO suspect</p>
</blockquote>
<p>Yeah, that was not necessary. I was playing with the idea of "reactive" and my little bit of knowledge there is "functional reactive programming". Channels seemed like Go's react like crap. It's definitely overkill.</p>
<p>Thanks for the feedback!</p></pre>0xjnml: <pre><p>Quite good for a first stab. Please use gofmt before committing.</p></pre>: <pre><p>[deleted]</p></pre>Crazy__Eddie: <pre><p>Ooh. Forgot about that thing. I saw it and meant to use it. Thanks!</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传