Go for Web Development

polaris · · 1209 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>I just decided that i will do our next project in Go, since i heard great things about it. I am switching from Node/Io.js to Go so has anyone from you guys switched from node to go and how was it especialy what you guys recommend to look at when starting web dev with go?</p> <hr/>**评论:**<br/><br/>sedmonster: <pre><p>What are you looking to build?</p> <p>As with any project, there are different platforms/languages/tools that are better or more poorly suited for the task at hand. IMO, I don&#39;t think &#34;hearing great things&#34; is a good reason to switch platforms, unless you know the substance of what it is great at and how that fits into your goals.</p> <p>More constructively, for instance if you&#39;re building out large, complex REST APIs and you think that building it out in Go will be faster and easier than in Rails::API, you will probably not find that to be the case. On the other hand, if speed/performance/executable size matters, Go is definitely quite good at that. And that&#39;s just high level -- nevermind the database bindings you will need to integrate, user auth, etc.</p></pre>fr4nk3n: <pre><p><a href="https://github.com/astaxie/build-web-application-with-golang/blob/master/en/preface.md" rel="nofollow">Here</a> are quite a few tutorials (written by astaxie), I would go through them all if I was starting with web development with Go (I haven&#39;t used node though). What will the project be?</p></pre>jan1024188: <pre><p>If you want to build an api, look into <code>go-restful</code>.</p></pre>space-llama: <pre><p>I&#39;d mostly suggest sticking to the standard library until you find some pain point that a small library solves. A lot of web framework libs for Go end up either recreating the standard lib&#39;s net/http package, or offer a gimmick in exchange for restricting transparency.</p> <p>web dev in Go is very boring since there&#39;s usually one or two ways to sanely write/layout the packages and so there&#39;s not a lot of creative thought that needs to happen, just a lot of typing. I do this every day.</p></pre>pusic007: <pre><p>I was big node.js fan, but then I decided to try Go. It is much easier to work with go code than with javascript when it comes to refactoring and testing. IMHO GoSublime and vim-go are quite good in comparison with available alternatives for node.js. Currently I am working on e-commerce project, and of course I am building it with Go. There are many web frameworks out there, but I am using Neo <a href="https://github.com/ivpusic/neo" rel="nofollow">https://github.com/ivpusic/neo</a>. Most probably you will need ORM, and I can recommend you <a href="https://github.com/jinzhu/gorm" rel="nofollow">https://github.com/jinzhu/gorm</a>. For testing there is one awesome thing called <a href="http://goconvey.co/" rel="nofollow">http://goconvey.co/</a>. If you want integration testing you can check <a href="https://github.com/ivpusic/httpcheck" rel="nofollow">https://github.com/ivpusic/httpcheck</a>. There are also many small libraries for your specific situations. So far I always find good library for my specific situations. There are some things which I don&#39;t like in Go, but this is the case for every language. Go is for me currently best fit (for my current project).</p></pre>ZenSwordArts: <pre><p>Others already mentioned Astaxie&#39;s guide, which really is a good read. You will often hear to use Go&#39;s std lib and maybe use Gorilla in addition.. and not to use existing frameworks. I disagree with this point. You will have to reinvent the wheel more often than not. </p> <p>After having used <a href="http://beego.me/" rel="nofollow">Beego</a>(also made by Astaxie) for several projects, I have to conclude that it is a really good framework. The documentation can tricky at times but the code is really clean so you can look it up if the docs fail. In my opinion Beego is the most complete framework for Go. </p></pre>Zilog8: <pre><p>I&#39;d like to tack on to this question. I&#39;m fairly familiar with basic coding in Go (I&#39;ve solved 120 <a href="https://projecteuler.net/" rel="nofollow">Project Euler</a> problems. Without googling the answer :-) ), but I know zero about web development beyond:</p> <pre><code> &lt;html&gt;&lt;body&gt;Hello World!&lt;/body&gt;&lt;/html&gt; </code></pre> <p>Any recommended guides, etc.?</p></pre>jbuberel: <pre><p>As noted by others, <a href="https://github.com/astaxie/build-web-application-with-golang/blob/master/en/preface.md">Build Web Applications with Go</a> is a great starting point.</p></pre>diegobernardes: <pre><p>thx! very nice link</p></pre>ApatheticGodzilla: <pre><p>Depends. If your app has a lot of repetitive CRUD I&#39;m not sure Go is the best choice - I built a project with Django Rest Framework and Angular last year and adding all the bits and pieces - routing, models, permissions etc was quite painless. Doing all that in Go would be doable, but kind of pointless.</p> <p>On the other hand if I were building something small and fast, perhaps using websockets - a game or chat app, say - the kind of thing I&#39;d probably do with node - then I&#39;d definitely use Go. I find the whole callback/promises mess of Node.js a huge PITA beyond anything trivial.</p></pre>

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

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