<p>I know there are several blogpost about the right structure for Go based web apps but I would like to know what works best for you in production and why?</p>
<hr/>**评论:**<br/><br/>mishudark: <pre><p>currently, at Schibsted we use gokit for several projects in production, processing large amounts of data, the structure that proposes works great </p></pre>titpetric: <pre><p>Just to save somebody some minutes reading the readme and browsing the page to find out what exactly gokit proposes, I think <a href="https://gokit.io/examples/stringsvc.html">this should provide some insight</a>. My naive take aways:</p>
<ol>
<li>declare your application as an interface,</li>
<li>implement your application logic to satisfy said interface,</li>
<li>provide a request transform that will make translation from http request object into an application call,</li>
<li>provide a response transform that will make the translation from your app logic back to a http writer</li>
</ol>
<p>This leaves you with a pretty well documented application implementation, its inputs and outputs. It doesn't really suggest that you should use packages for example (you could, sure), or how to nicely name your files to be managable if they grow into a larger monolith codebase.</p>
<p>Is that about the gist of it?</p></pre>AngryGoNerd: <pre><p>Thanks for the reply! Any advices for startups new to go?</p></pre>mishudark: <pre><p>Gokit has a great set of examples in the docs, we have an anti-fraud system with uptime close to 99%, yes the other 1% was not related to Go, instead was a bad cloud configuration </p>
<p><a href="https://medium.com/@benbjohnson/standard-package-layout-7cdbc8391fc1">https://medium.com/@benbjohnson/standard-package-layout-7cdbc8391fc1</a> is a must to read </p></pre>ptman: <pre><p>I wrote an example go web app without frameworks: <a href="https://github.com/ptman/urlredir">https://github.com/ptman/urlredir</a> . Feedback welcome</p></pre>metamatic: <pre><p>I think it'd be helpful to people looking at larger projects if it was refactored to put model, controller and views into separate packages. A lot of confusion is over how to break up applications into manageable size chunks, and right now you have everything in <code>main</code>.</p></pre>steffen25: <pre><p>I would like to give a shoutout to my project golang.zone </p>
<p>I had some "trouble" finding the right structure so this is where I'm at now could probably be done in a more smart way.</p>
<p><a href="https://github.com/steffen25/golang.zone" rel="nofollow">https://github.com/steffen25/golang.zone</a></p>
<p>First project in Go using as few third party libraries as possible trying just to stick with the std libs. </p>
<p>The project is running live as well on so feel free to try it
Feedback is welcome :) </p></pre>allhatenocattle: <pre><p>The README doesn't say what the project is about, and the link at the top of it just responds with </p>
<p>Hello gopher!</p>
<p>It would help if you added more info such as what the project does and who might want to use it.</p></pre>steffen25: <pre><p>You are totally right I will update the readme later. Thanks :)</p></pre>AngryGoNerd: <pre><p>Looks nich I forked It I will take a closer look at the weekend and give you feedback to it soon!</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传