Webapp Project Folder Structure

agolangf · · 416 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Webapp Folder Structure</p> <p>I&#39;m trying to do it the kosher way, but I&#39;m getting conflicting answers when I&#39;ve looked around. I want an isolated workspace for a project and I&#39;m not sure the proper way it should look.</p> <pre><code>webappproject/ bin/ webappproject.exe pkg/ gorilla/sessions/ gorillastuff.go otherguypackage/ hisstuff.go hisotherstuff.go public/ css/ landing.css otherpage.css html/ landing.html otherpage.html js/ landing.js otherpage.js png/ graphic.png dumbergraphic.png src/ main.go projectpackage/ mycustomfunctions.go mycustomstructs.go morestuff.go </code></pre> <p>I think I may be overthinking this and am making this more complicated than it is supposed to be.</p> <p>Should my package go in the pkg folder I made?</p> <p>Am I on the right path? People always reference the official documentation as if it can&#39;t be clearer, it can. God bless those who translate into even more basic tutorials for dummies like me.</p> <hr/>**评论:**<br/><br/>dstroot: <pre><p>Use Dep to manage external dependencies. Dep will place them in /vendor for you. Your internal packages can go in /pkg. Stuff like /pkg/handlers, /pkg/router, pkg/models, etc.</p></pre>kylequest: <pre><p>Take a look at this blog post “Go Project Layout” <a href="https://medium.com/golang-learn/go-project-layout-e5213cdcfaa2" rel="nofollow">https://medium.com/golang-learn/go-project-layout-e5213cdcfaa2</a> It&#39;s pretty generic, but it should work. Put you main.go under cmd/your_app_name. You can keep &#39;public&#39; as a top level dir or you can put it under web/static.</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

416 次点击  
加入收藏 微博
0 回复
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传