<p>Clean Architecture Boilerplate Generation Tool
<a href="https://github.com/strtob01/clean" rel="nofollow">https://github.com/strtob01/clean</a></p>
<p>A tool that keeps you and your code clean :)</p>
<p>In case Clean Architecture is something new to you. Check out this link: <a href="https://8thlight.com/blog/uncle-bob/2012/08/13/the-clean-architecture.html" rel="nofollow">https://8thlight.com/blog/uncle-bob/2012/08/13/the-clean-architecture.html</a></p>
<hr/>**评论:**<br/><br/>shovelpost: <pre><p>Please do not blindly follow patterns. Surely the clean achitecture is an excellent pattern but it needs to be applied in the context of Go. By blindly following the pattern, you are missing out on Go's strengths and you end up writing Java with Go syntax. There's been many other <a href="https://github.com/roblaszczak/go-cleanarch" rel="nofollow">implementations</a> already and most of them suffer from bad package naming making the codebase quite the opposite of clean.</p>
<p>If you want something truly clean and simple, I'd recommend following some of Ben Johnson's <a href="https://medium.com/@benbjohnson/standard-package-layout-7cdbc8391fc1" rel="nofollow">tips</a>.</p></pre>gentleman_tech: <pre><p>agree. This is Go written by a Java programmer.</p>
<p>Go programmers typically put tests right next to the file that they test, rather than in a separate "tests" directory, for example.</p>
<p>Go has semantics around vendoring that mean "lib" is badly named</p>
<p>If you're going to build a huge sprawling project, then Clean Architecture is worth knowing about. But I think applying it this rigidly from the start is a mistake. Like any pattern, it's a guideline, not dogma.</p></pre>strtob01: <pre><p>Writing tests in a separate test package has the benefit that the package to be tested gets tested as a consumer of it, since its internals are not accessible by the test package. If you require to have tests that test internal things too, those _test.go files can be created in the package to be tested in spite of the Clean tool generating a separate test package for you.</p>
<p>Regarding the "lib" package, I thank you for your feedback and will consider it.</p></pre>strtob01: <pre><p>Could you elaborate on how you're missing out on Go's strengths if you apply Clean Architecture to a project?</p></pre>Genkai972: <pre><p>Just learned about Clean Architecture last week thanks to @UnchartedFr answer in <a href="https://www.reddit.com/r/golang/comments/6hk79u/recommendations_for_good_golang_projects_to_learn/" rel="nofollow">https://www.reddit.com/r/golang/comments/6hk79u/recommendations_for_good_golang_projects_to_learn/</a>, and spent 18h of my weekend implementing it on a personal project, this project looks like an AMAZING idea !!!</p></pre>strtob01: <pre><p>Glad you found it useful :)</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传