<p>Hello all,</p>
<p>I've identified that the strengths and weaknesses in Go align with the goals I have for writing a new set of services in an upcoming project. Can you recommend any tutorials you may have used, tools, and common pitfalls? </p>
<p>I'm most interested in laying out my projects in a sensible manner, so I'd really like to zero in on strategies for building readable code in a readable project tree. Most tutorials write the structs, interfaces, handlers, routes, middleware, and server Initialization in the same file..which seems weird. </p>
<p>A sample project you can share in GitHub would be even better (teach a man to fish and all that)! </p>
<p>Apologies for the breadth of questions, it's a good bit to wrap your head around with so many Node conventions buried in your head. </p>
<p>Edit: I'd like to stay away from frameworks, it seems to be for the best to use as many built in libraries as possible. Feels safer that way!</p>
<hr/>**评论:**<br/><br/>_ak: <pre><p>Start out by putting everything in one file, if that grows too large, split things into files in a way it feels natural to you. Don't split out things into separate packages until you specifically <em>need</em> to have something in a different package.</p></pre>RickAndMorty_forever: <pre><p>The <code>package</code> keyword is actually tripping me up a bit here. I took the day to write some actual code and asked a follow-up question <a href="https://www.reddit.com/r/golang/comments/47gu61/question_packages_are_not_namespaces/" rel="nofollow">here</a> now that I'm wanting to go the separate files route. </p></pre>thepciet: <pre><p>The golang talks on YouTube were what hooked me.</p>
<p>Project layout takes practice, just put everything in main, then go overboard with packages, then you'll go back to center with a good way to split. Understanding the value of interface types goes along with this, which is maybe a ways down the road.</p>
<p>You are going to have a tough time delivering something if your entire team is not very experienced with software projects. Go makes many things better, but there's a lot to know before knowing what better is.</p></pre>mostlywaiting: <pre><p>If you're done with the official docs, start reading the official lib directly. It is very well put together. Copying its style would be a great place to start (or even stay!) and you'll be even more familiar with the standard tools.</p>
<p>Don't neglect the tests, either.</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传