4 ms·
Why is this written in Go and not Shell? Why isn't this just one file? Here is how such tools should really be done: https://github.com/rupa/z https://gith
by x1024 11y ago
Why is this written in Go and not Shell?
Why isn't this just one file?
Here is how such tools should really be done:
https://github.com/rupa/z https://github.com/rupa/z
- fiatjaf 11y agoWhat do you mean "written in Shell"? Because you want it to work only in some shells and not others?
- x1024 11y agoAre we still pretending that it's impossible to write portable shell code? Ok, then. Maybe it is in the general case, but this... really isn't "the general case".
- fiatjaf 11y agohahahah, yeah.
- zquestz 11y agoI didn't want the users on Windows to require cygwin to run this. That dependency is huge and would be required if they want shell support in Windows.
- oolongCat 11y agoWell no one is stopping you from writing it in shell.
- x1024 11y agofunction gs() { open http://www.google.com/search?q="$*" ;} https://news.ycombinator.com/item?id=10966210 https://news.ycombinator.com/item?id=10966210 "So difficult, definitely requires installing 100MB of libraries and package managers."
- zquestz 11y agoThis does not query escape the search, which means you are sending an incorrect URI to google.
- threatofrain 11y agoWhen it's compiled, isn't the user just interacting with a nice binary? Among languages that compile to binary and have a nice standard library for http requests, I'm not surprised that somebody choose Go. And if you want to talk about portable, I think people would rather work with Go than shell.
- mijoharas 11y agoI started using Go for exactly this reason. It was something that felt slightly too advanced to write in shell, and figured I'd try Go (command line tool). I can't say I'm too much of a fan of the language, but the things it does well (fast compile times, simple portable binaries) it does very well.
- zquestz 11y agoThis is exactly why I did it in Go. It is just a binary. Has full support for OS X, Windows and Linux. Not to mention I find that Go is far more readable than shell scripts.