<p>I've used Linux for the past 20 years.. normally do everything in bash scripts.. can read through a Perl script to adjust or fix things.. same with python, but the indentations get me mixed up.</p>
<p>It seems lately that you need to learn to code to get promoted etc lately at my job.</p>
<p>We do a lot of go coding at work. Do you think I should get more into python.. then switch over to go.. or jump into go straight from bash?</p>
<p>Any popular tutorial sites? I've seen a few.</p>
<p>Thanks</p>
<hr/>**评论:**<br/><br/>jot1109: <pre><p>Devops here. Used to do shell, perl, and python as scripting languages in the past. Did not cut it for me once the scripts got longer than one page. VERY happy with Go, wiped everything else off the table.</p>
<p>Compared to Perl, you need to type more. I do type fast, so no worries. Error handling needed some patience from my side.</p>
<p>You probably have to get used to the compile cycle though. I just open up two terminal windows, one 'vim' and one 'watch go run main.go'. Nice. The mindblowing difference is when you rollout the script on more than one server: one single binary without any external dependencies. No more CPAN, Python2 <-> Python3 libs, pip, rpm -dev packages. Copy one file - done.</p>
<p>Most of my tasks are some sort of glue code, usually performance is not much of an issue. For 10% it is, and Go feels significantly faster to me than scripting languages: <a href="https://benchmarksgame-team.pages.debian.net/benchmarksgame/faster/go-python3.html" rel="nofollow">https://benchmarksgame-team.pages.debian.net/benchmarksgame/faster/go-python3.html</a>.</p>
<p>JSON, XML, REST? Email? Email templates? tar, zip, gzip, bzip2? SHA 1-512? base64? csv? gif, jpg, png? check. All included in the standard library. Get vim, get vim-go, get go, Go!. My wild guess is that Go and containers will experience the same long-lasting symbiosis as C and Unix, so you are well prepared for the next 20 years.</p>
<p>One last thing: if you like Linux/Unix, you might like one of the creators of Go. Even github respectfully reserved his anticipated user ID just in case (<a href="https://github.com/ken" rel="nofollow">https://github.com/ken</a>). </p></pre>thatarchguy: <pre><p>Coming from python I've noticed it's much more work to do scripting. Please let me know otherwise though, I want to use Go! </p>
<p>My recent task was to parse a rather large json response from a webserver and use the presence of a key to decide to kick off another process. </p>
<p>Usually in python, I'd:
- pop open an interpreter
- import requests
- requests.get(url), json.loads() into dictionary
- if data.get('item'): do_this()</p>
<p>It's easy since I can play around in the interpreter and play with the response json before putting this all into a script to use. </p>
<p>But for go, I quickly realized I was in over my head. I had to create a struct of the json response. It had a lot of keys, and thankfully I found a webservice that converted json to go structs for me. From there it wasn't so bad. <code>json.Unmarshal()</code>is similar to <code>json.loads()</code>. But if that json to struct service didn't exist I would have given up on the spot and popped open a python file. </p>
<p>I did later find out I could have used <code>map[string]interface{}</code> for the json unmarshall which makes things much easier. But it's still been massive trial and error for my other ETL scripts. Maybe I'm just used to opening an interpreter with dynamically typed Python and copying it into a script when I have it right. Maybe I've just been in python land too long. I just haven't found go as easy to use for scripting as I keep reading about. </p></pre>BrokenPhoneBooth: <pre><p>What type of application development would get you promoted? Just start doing it and demonstrate that you are not only capable, but already doing the work. </p>
<p>If you are doing bash and perl I would imagine you are a sysadmin? I would say python and Ruby may be more what you need to learn but obviously any development experience will synergize.</p></pre>rbetts: <pre><p>Great answer. </p>
<p>Go and (sane) Perl have some similarities (heavy use of builtin slices/arrays and maps/dicts) and curly-brace syntax. If you can read and write basic Perl, learning go should be pretty straight forward. </p>
<p>But as mentioned above - there might be better reasons to learn python?</p></pre>expatMT: <pre><p>20+ years of Linux skills here too. Done Bash, Perl, PHP, and got into Go about three years ago. All are excellent tools for the job required and how happy you are to use for a particular task.</p>
<p>That being said, I really enjoy working with Go far more than other languages, and management teams are becoming very interested in using Go more and more.</p>
<p>Get into it. It's an excellent tool.</p></pre>arp242: <pre><p><a href="https://arp242.net/weblog/learning-a-programming-language.html" rel="nofollow">https://arp242.net/weblog/learning-a-programming-language.html</a></p>
<p>In the specific case of Go, <a href="https://www.amazon.com/Programming-Language-Addison-Wesley-Professional-Computing/dp/0134190440" rel="nofollow">The Go Programming Language</a> is the best book that I know of. It does assume some programming knowledge though.</p>
<p>As for Go vs. Python vs. Perl, I agree with the commenters that it would depend a lot on what you're hoping to do with it.</p></pre>hagge: <pre><p>Do Go directly if your company already is doing Go. Go works as a tooling language for DevOps/Sysadmin type work too so might as well jump over Python.</p></pre>s0merandomletters: <pre><p><a href="http://exercism.io/languages/go/about" rel="nofollow">http://exercism.io/languages/go/about</a></p></pre>Magnus919: <pre><p>Get straight into Go. With Python, you're going to have to get your head around Object Oriented Programming, which has a little bit of a learning curve coming from shell scripting. With Go, you're going from one functional language (bash) to a more sophisticated one (Go). If you were advanced in your use of bash scripting, I think Go is not going to be a cognitively steep hill to climb.</p></pre>chillysurfer: <pre><p>I love Go. It's a great tool. But if your primary job development is focused around bash scripts and automation, Python is most likely a natural next step. I haven't ever written a bash script and thought "I should've written this in Go".</p>
<blockquote>
<p>We do a lot of coding at work</p>
</blockquote>
<p>What kind of programming? Automation? Infrastructure tooling? We really can't answer the question of Python vs Go without knowing this.</p></pre>earthboundkid: <pre><p>Why Not Both Meme.gif </p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传