New to Go

polaris · · 718 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>I am currently working on a web app. I&#39;m using PHP / MariaDB to handle the content of the pages and the user input. Based on the users input, I will need to do some calculations every hour or every day.</p> <p>I have one server ready for the users to interact with and another server to do the calculations.</p> <p>I am considering Go for the server to do the calculations.</p> <p>Thoughts?</p> <hr/>**评论:**<br/><br/>anoland: <pre><p>Things you will need to read:</p> <p>Effective go. <a href="https://golang.org/doc/effective_go.html">https://golang.org/doc/effective_go.html</a></p> <p>Go database example: <a href="http://go-database-sql.org/">http://go-database-sql.org/</a></p> <p>Build a binary that connects to the db and does the calculations. Run it on a cron job. You should be set.</p></pre>levidurfee: <pre><p>Thank you for those links. I believe Go will do exactly what I need and do it fast.</p></pre>KimIlYong: <pre><p>Go is much, MUCH faster than PHP. If you do only a simple addition from database values it does not matter, but for everything more complicated (=CPU intensive) then Go will shine.</p></pre>PM_ME_YOUR_VIMRC: <pre><p>Why, so you can get more upvotes on hn?</p></pre>klaaax: <pre><p>Sorry but you don&#39;t need go for that. I would stick to PHP. Either use something like crontab or gearman to launch workers (PHP scripts) that will perform the calculations and populate your database with the result, as background processes on your server. There is absolutely nothing that would make the use of Go relevant here. </p></pre>skelterjohn: <pre><p>Go is a programming language, and this is a programming task. So, Go is relevant.</p></pre>klaaax: <pre><blockquote> <p>Go is a programming language,</p> </blockquote> <p>so is brainfuck , that&#39;s not the point here. The point is using Go for the sake of it in a PHP project that doesn&#39;t require it is silly. Misleading people asking this kind of questions is at the very least dishonest. That person doesn&#39;t need Go. That person can rely on tools that are well tested an predictable, which will give him 0 development or deployement overhead.</p></pre>dAnjou: <pre><p>While I like Go and dislike PHP, this is reasonable advice. Of course it depends on various other things but for the sake of maintainability I&#39;d stick to the language that&#39;s been used the most in the codebase and that I&#39;m most productive in. You probably already have a CI in place and a proper development environment for PHP. Don&#39;t underestimate what maintaining multiple toolchains and environments means for maintenance overhead.</p></pre>theonlycosmonaut: <pre><p>On the other hand, learning new things is good!</p></pre>dAnjou: <pre><p>Sure, but there&#39;s a right and a wrong time for everything ;)</p></pre>hobbified: <pre><p>And neither you nor <a href="/u/klaaax" rel="nofollow">/u/klaaax</a> could reasonably have any idea whether or not this is that time.</p></pre>dAnjou: <pre><p>Does this make our point less valid?</p> <p>OP asked: <em>Thoughts?</em>, which is a very open question. Based on the rather limited information in the original post both <a href="/u/klaaax" rel="nofollow">/u/klaaax</a> and me expressed very valid and reasonable thoughts.</p></pre>greeedy: <pre><p>I agree, it&#39;s better to stick to the language you have and try to have a clean architecture than using and whole other language. If he needs speed or something, go could be a viable option. But so would be C,C++ or whatever. Use the tools you need, for the job you want get done, not the ones who are popular. And if you want to learn something new, make a weekend play project!</p></pre>levidurfee: <pre><p>The calculations part of the web app won&#39;t be needed until after I get a decent amount of data from the users. I am going to attempt to write it in Go. If I feel that it isn&#39;t working out and I think I could have written it better in PHP, then that is what I&#39;ll do.</p> <p>I learn best when making something that <em>might</em> be used.</p> <ul> <li>I don&#39;t have a deadline</li> <li>I have been interested in Go for awhile</li> <li>If I can&#39;t do it in Go, I can do it in PHP</li> </ul></pre>

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

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