5 ms·
Controversial perhaps, but I now use Go where I used to be a prolific shell script script coder. Main reasons: - Fewer opportunities for foot-guns - Eas
by traceroute66 3y ago
Controversial perhaps, but I now use Go where I used to be a prolific shell script script coder.
Main reasons:
- Fewer opportunities for foot-guns
- Ease of portability, no dependencies, e.g. no more "is jq installed ?"
- Consistent cross-platforms, e.g. no more "is this system using GNU sed ?"
- Modern stuff like crypto, and "internet stuff" is just quicker and easier to do in Go.
- frizlab 3y agoEven more controversial, I use Swift.
- jalino23 3y agoswift is so nice to code with
- unixhero 3y agoSwift for system operations?
- frizlab 3y agoI have a sh*ton of conveniences that make it good. Using Foundation only would be a pain indeed (for now; they are rewriting Foundation in Swift with better APIs, so it might get better).
- kreetx 3y agoJust as controversial, I use Haskell. Everything has a type, no more interpolation foot-guns, etc. And it pays off in slowly building a library on top. (Much if not all of it applies to Swift as well I believe.)
- LucasLarson 3y ago> slowly building a library on top What does this part mean?
- jabbany 3y agoIf Go why not something like Python though...?
- traceroute66 3y agoBecause Python is godawful for dependencies. With Go, you write, you compile, you ship the binary, job done.
- geocrasher 3y agoIs Go genuinely as dependency independent as bash on a fresh Linux install? If so I'd find this very interesting and perhaps worthwhile to learn. I work in an environment where everything is done at the Linux command line. I'd be thrilled to re-do some of my my complex bash scripts in Go if there is a good advantage to doing so.
- mbwgh 3y agoThe idea is that if you need dependencies, you only need them present during compilation on the machine you develop on. You then compile a statically linked binary and copy this to the machine where it's needed. There may be other advantages like static types, editor integration and so on, but that's beside the point.
- dharmab 3y agoGo's dependency management is in a really good state. For building your code, Go modules are generally easy to use and editor integrations exist to automatically update your dependencies as you type. Then you build a static binary and distribute it, no installers or packages required.
- adr1an 3y agoThat sounds like a lot of steps when you require interaction (e.g. for bash I list files, then try find, then xargs with echo, etc until I got what I wanted..)
- elzbardico 3y ago
- yjftsjthsd-h 3y agoTwo catches I could see: * Great if you can do everything natively in Go, loses advantages and I suspect gets somewhat cumbersome if you have to shell out. * Harder to inspect on target system. If I encounter a random shell script someone left on a server, I can read it; with a binary I'd have to hope I can find the source. Otherwise... yeah, that seems reasonable, and if you're already good at Go, sensible.
- fsckboy 3y agoI can't go along with your reasons at all (installing go on every machine is not solving a portability problem, it is the portability problem) but I'm going to leave that aside. can Go be used REPL as a shell CLI? and do everything I need to do from the CLI? because that's why I use bash for scripting. An equal amount of time I spend typing at the command line, and I one language is the language I want to use.
- mirashii 3y agoIt’s not go as a literal replacement for bash, as in you write golang when interacting with your own machine. It’s go binaries instead of bash scripts. You’re still distributing one file, but now with all the GP’s stated benefits
- dharmab 3y agoThere's a Go REPL called YAEGI, but it's not a similar experience as using a shell.
- traceroute66 3y ago> (installing go on every machine is not solving a portability problem, it is the portability problem) but I'm going to leave that aside. What a clueless reply. Complete FUD. Yeah, you can "leave that aside" because you have no clue what you're talking about. The ONLY place Go needs to be installed is on the developer's machine. With Go you write, you compile/cross-compile and SHIP THE COMPILED BINARY job done. Do some homework next time before engaging in completely unfounded FUD.
- wrboyce 3y agoCan’t help but feel like the tone of your response is completely uncalled for.
- traceroute66 3y ago> Can’t help but feel like the tone of your response is completely uncalled for. Literally five seconds on Google could have shown the guy he was completely wrong. But no, instead he posts unfounded FUD about how he will courteously "leave aside" the demonstrably INCORRECT claim that Go runtime needs to be installed on all machines that a Go program runs on. So don't give me a hard time about it when it was that poster who made the original arrogant comment.
- smekta 3y agoControversial opinion: I use Python for scripting. Terse syntax, but more structured than bash.
- ndsipa_pomu 3y agoDoesn't that mean that the binary is platform dependant? i.e. you need a different binary to run on Intel vs Arm?