<p>Is it practical to use Go for making autoinstall scripts like for example
<a href="https://github.com/Kerwood/Rtorrent-Auto-Install/blob/master/Rtorrent-Auto-Install-4.0.0-Debian-Wheezy" rel="nofollow">https://github.com/Kerwood/Rtorrent-Auto-Install/blob/master/Rtorrent-Auto-Install-4.0.0-Debian-Wheezy</a>?
Go as alternative to shell script. Worth it?</p>
<hr/>**评论:**<br/><br/>natefinch: <pre><p>I think so. Checkout <a href="https://magefile.org" rel="nofollow">https://magefile.org</a> - a makefile replacement using Go. Bash is ugly and the error handling is particularly atrocious. Error handling is Go's strength... you always know what commands can fail, and so it's easy to see where your script might fail and so you are forced to think about what to do in that situation.</p>
<p>An install script in go will definitely be a larger number of lines than it would be in bash... but it'll be a lot easier to read, and probably a lot less prone to bugs, since there's a lot less magic.</p></pre>bobbafeftta: <pre><blockquote>
<p>Error handling is Go's strength... you always know what commands can fail</p>
</blockquote>
<p>First time I've heard go's error handling summarised like this, I like it.</p></pre>deusmetallum: <pre><p>Problem with using go for an install script is that it's very long winded. For instance, if you wanted to do a cp or mv, you have to write a lot of code to check the files exist, and that there's nothing at the destination already.</p>
<p>With a bash script, at least most of that checking is done for you, and you're bringing tools together, rather than reinventing all of the tools.</p></pre>paul2048: <pre><p>You're getting downvoted but 1/ shell scripts are transparent 2/ shell scripts are simpler because that's what they were made for.</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传