Shell-ish scripting in Go with ease
9 comments
·January 31, 2025breadchris
pairing this with yaegi [1] would be interesting. You could having a REPL open doing os operations and when you get the data looking like you want, you select which lines to save to a file.
AzzieElbab
I hate go-lang with passion, but these two libs are really cool
throwaway77385
How come the hate? That's a pretty strong emotion for something as benign as a programming language.
wswope
Not OP, but the usual talking points were covered pretty well in this thread from yesterday: https://news.ycombinator.com/item?id=42884337
To sum it up, the biggest complaints are error handling, null handling, and dependency management. And y’know, being backed by a company of ghouls hellbent on extracting value for themselves at the expense of society.
summarity
Strongly opinionated languages beget strong opinions on the same, both positive and negative.
latchkey
These sorts of comments always make me wonder what you prefer.
LinuxAmbulance
Very nice, bookmarking this!
I just rewrote a tangled 500 line shell script in go.
It was my first time writing a golang project at work, so I'm sure it could have been better. But writing it the naive way, with all the required golang error handling, it ended up taking about 10x more lines of code in golang than the original bash script.
It does have a dramatically better UX (largely thanks to spf13's cobra and viper), and is way faster than the original, and the codebase is a lot cleaner and more maintainable. So I think it was worthwhile for the users and maintainers.
But still, 10x more lines of code. I like the OP, but I'm still not sure I would reach for golang for short shell scripts.