<p>hi I'm just looking for a few examples on GitHub. found 1 to date. I like to check out a few more if theres any out there. just to compare them. thanks guys! heres the example I've been looking at
<a href="https://github.com/ManuelKiessling/go-cleanarchitecture">https://github.com/ManuelKiessling/go-cleanarchitecture</a></p>
<hr/>**评论:**<br/><br/>neoasterisk: <pre><p>Just so you know, the package you found is more or less 'unclean' architecture in the Go world. When you bring a pattern from other languages you need to apply it to the Go world.</p>
<p>Here's some tips:</p>
<ul>
<li><a href="https://rakyll.org/style-packages/" rel="nofollow">https://rakyll.org/style-packages/</a></li>
<li><a href="https://medium.com/@benbjohnson/standard-package-layout-7cdbc8391fc1#.el775uizc" rel="nofollow">https://medium.com/@benbjohnson/standard-package-layout-7cdbc8391fc1#.el775uizc</a></li>
</ul>
<p>If you want to translate the clean architecture pattern in Go, those will help.</p></pre>eoin_ahern: <pre><p>yeah, thats what I was thinking. that's why I was in search of a second opinion.</p>
<blockquote>
<p>other languages you need to apply it to the Go world.</p>
</blockquote></pre>newbgopher: <pre><p>does the "clean code architecture" aka uncle bob pattern apply to Go also? im just curious to know what other solutions are out there.</p></pre>CaptaincCodeman: <pre><p>No reason why it can't. Here's my attempt at it:</p>
<p><a href="https://github.com/CaptainCodeman/clean-go" rel="nofollow">https://github.com/CaptainCodeman/clean-go</a></p></pre>newbgopher: <pre><blockquote>
<p><a href="https://github.com/CaptainCodeman/clean-go" rel="nofollow">https://github.com/CaptainCodeman/clean-go</a></p>
</blockquote>
<p>thanks for the sample repo!</p></pre>eoin_ahern: <pre><p>cheers! appreciate the link</p></pre>sh41: <pre><p>I don't know if this fits what you're looking for, but I'm very happy with and proud of the architecture of my personal site [0], and you're welcome to look at it and compare. It errs on the side of being simple and pragmatic rather than overly general.</p>
<p>I have plans for how to improve some of its parts, but for the most part, I'm very happy with it, and it's very functional. Of course, I'm always looking to improve and don't mind any constructive feedback.</p>
<p>[0] <a href="https://github.com/shurcooL/home" rel="nofollow">https://github.com/shurcooL/home</a></p></pre>eoin_ahern: <pre><p>I'm interested primarily in restful apis. The architecture would be slightly different I suppose because there is no view/UI layer. I presume you could replace the view with the routes with an Api. Im just not 100%. I guess the data and domain would remain relatively similar> what you're looking for, but I'm very happy with and proud of the architecture of my personal site [0],</p></pre>sh41: <pre><p>Fair enough.</p>
<p>There is a somewhat RESTful API component, see <a href="https://github.com/shurcooL/home/search?q=api" rel="nofollow">https://github.com/shurcooL/home/search?q=api</a>. However, the underlying HTTP implementation is both temporary and an unimportant implementation details, because all my clients/consumers are using the Go client.</p>
<p>I can update both the handler and client library at the same time, and while the HTTP API changes, all end consumers are unaffected.</p></pre>titpetric: <pre><p>I could point you to my books repo, for my <a href="https://leanpub.com/12fa-docker-golang" rel="nofollow">12 Factors of Go and Docker</a> book which I'm currently writing:</p>
<p><a href="https://github.com/titpetric/books/tree/master/12fa-docker-golang/chapter7" rel="nofollow">https://github.com/titpetric/books/tree/master/12fa-docker-golang/chapter7</a></p>
<p>It conforms and provides approaches in line with the <a href="https://12factor.net" rel="nofollow">https://12factor.net</a> recommendations (listed in the readme). In terms of how I structure my APIs, I hope that I've chosen some kind of loosely coupled package structure. As such, currently I can register/unregister API endpoints with one-line call in main.go - and can copy some standard API implementation between various projects (api/health.go for a "portable" API example). I'm happy with it, but given a few refactoring sprints I suspect I could improve some things (mainly in regards to common/redis.go, functional options, etc.). I hope it helps, and I also welcome comments from Go gurus that might have a look at the code.</p>
<p>Edit: linked the book which should in time provide a more broad viewpoint on 12 factor app development. It's already about 50 pages and growing.</p></pre>eoin_ahern: <pre><blockquote>
<p>improve some things (mainly in regards to common/redis.go, functional options, etc.). I hope it helps, and I also welcome comments from Go gurus that might have a look at the code.</p>
</blockquote>
<p>cool. this is all really useful info. cheers bro!</p></pre>titpetric: <pre><p>Hope it helps. There are also some wonderful very minimal frameworks out there, I have <a href="https://github.com/pressly/chi" rel="nofollow">pressly/chi</a> bookmarked because it's using Go 1.7 contexts and might be better suited for more complex applications.</p></pre>eoin_ahern: <pre><p>never heard of 12factor.net. ill check it out.</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传