Whats the best way to learn go for a complete newb programmer?

agolangf · · 793 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>I&#39;m new to programming and want to try my hand at picking up go. I&#39;ve gone through the tutorial and a few other introductory guides. Whilst I understand the high level concepts I&#39;m struggling to put that understanding into use because most of the tutorials assume you understand the syntax. Would it be a good idea to go and learn the C syntax and then circle back to learning Go?</p> <hr/>**评论:**<br/><br/>perihelion9: <pre><p>I wouldn&#39;t recommend using C tutorials to understand Go. The two languages accomplish very different goals, and the approaches you&#39;d use to solve comparable problems in each language are <em>very</em> different.</p> <p>There are two things I could suggest, which depend on your goals. If you want to learn Go (which is a wise decision!), I&#39;d simply say <em>stick with it</em>. Practicing coding is the only way to get better, and you&#39;ll get more comfortable with the syntax the more you use it. </p> <p>With that in mind, if you&#39;re not deadset on Go, I usually recommend that beginners learn Python or Java. Neither have all the modern concepts and pragmatism that make Go so appealing, but both have been used for decades to solve problems that you&#39;re likely to run into. You&#39;ll have many more resources to learn from. You&#39;ll also find that any C-like (well, algol-like) language looks pretty similar. Once you feel very comfortable with one, it&#39;s not a huge leap to move to other languages; Go included. It&#39;s not uncommon for experienced developers to start a job without having much experience in the language of choice, and being able to pick it up purely because of its&#39; similarity to the languages they <em>do</em> know.</p></pre>heyjustaquestion: <pre><p>Thanks mate. I had toyed with the idea of learning Python and circling back but at the same time I wanted to try just getting down to business - I really want to be proficient in Go and investing time elsewhere seemed a little counterintuitive but I&#39;m not a developer... </p> <p>Its just things like m := map[string]int{&#34;three&#34;: 3, &#34;four&#34;: 4}</p> <p>I&#39;m often left questioning whats the semi colon and equals there for, why are elements encapsulated into brackets etc. At the same time I&#39;m getting places just stopping and googling really broad topics to get a base understanding. </p></pre>asdf072: <pre><p>That one got me, too, and since it&#39;s used everywhere, it&#39;s hard to sidestep. The := is a shorthand assignment operator. Instead of telling go what the type should be, have go figure it out.</p> <p>explicitly tell go i is an integer</p> <pre><code>var i int </code></pre> <p>but go can also tell the type on initialization</p> <pre><code>i := 6 </code></pre> <p>You can only use := on initialization, though!</p> <pre><code>j := false j = true // Notice that it&#39;s a regular = operator after declaration of j </code></pre></pre>jussij: <pre><blockquote> <p>I&#39;m often left questioning whats the semi colon and equals there for</p> </blockquote> <p><a href="https://tour.golang.org/basics/10" rel="nofollow">https://tour.golang.org/basics/10</a></p></pre>addos: <pre><p>This was the training material used during the bootcamp for gophercon. You might find these resources helpful. <a href="https://github.com/ArdanStudios/gotraining">https://github.com/ArdanStudios/gotraining</a></p></pre>heyjustaquestion: <pre><p>Thanks this looks like it&#39;ll plug a few holes missing in other tutorials - really appreciate it.</p></pre>calebdoxsey: <pre><p>Maybe worth a look: <a href="http://www.golang-book.com/guides/bootcamp" rel="nofollow">http://www.golang-book.com/guides/bootcamp</a></p></pre>st3fan: <pre><p>Pick a project and start hacking on some code. Let me know if you need any suggestions. </p></pre>TheArtOfPerception: <pre><p>Not OP, but I wouldn&#39;t mind suggestions.</p></pre>mwholt: <pre><p>We could use more contributors on the <a href="https://github.com/mholt/caddy" rel="nofollow">Caddy</a> project - lots of cool stuff in the issues to work on (mostly suggestions, not bug reports!) as well as tests and stuff.</p></pre>mohi666: <pre><p>It looks like an interesting project. I&#39;ll go over it later tonight and will hit you up to get more info on contributing to it.</p></pre>heyjustaquestion: <pre><p>That would be really useful</p></pre>huxoll: <pre><p>I like to start new languages with a &#34;koans&#34; project. It started with Ruby, as far as I know, but now they are out there for many languages. These projects get you hands-on immediately, with small snippets of code with a flaw you need to fix, and meanwhile learn the syntax. They start small and build up to the advanced concepts.</p> <p>It also introduces unit testing, which is a super valuable concept you&#39;ll want to learn anyway.</p> <p>You can find go koans here: <a href="https://github.com/cdarwin/go-koans" rel="nofollow">https://github.com/cdarwin/go-koans</a></p></pre>heyjustaquestion: <pre><p>I&#39;m trying to get started however after I run go test I get this error: </p> <blockquote> <p>exit status 1 FAIL _/home/nitrous/go-koans 0.003s</p> </blockquote></pre>heyjustaquestion: <pre><p>I&#39;m using Nitrous as the IDE</p></pre>baijum: <pre><p>I started working on a new document targeting beginners. You can use the first two chapters now. But afterwards you need to find some other resources. <a href="http://golang.muthukadan.net" rel="nofollow">http://golang.muthukadan.net</a> Please let me know, if you have any feedback.</p></pre>jupiter909: <pre><p>I&#39;d highly suggest something like: <a href="https://gobyexample.com/" rel="nofollow">https://gobyexample.com/</a> for someone that is really new to programming.</p> <p>If you want to learn Go, then just study Go as is.</p></pre>FIuffyRabbit: <pre><p>I&#39;m a full supporter of beginners start learning C/C++ or Java first instead of Python or Go. If you are on your own though, that might be a bit harder. </p></pre>

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

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