6 ms·
Go is my tool of choice for scripting now. Compiles fast and has an extensive standard library. I've tried using node in the past but all of the async handlin
by mmargerum 6y ago
Go is my tool of choice for scripting now. Compiles fast and has an extensive standard library. I've tried using node in the past but all of the async handling turned me off. I prefer go's way of implementing concurrency with go routines.
- jfkebwjsbx 6y agoGo isn’t scripting, it is compiled, which defeats the purpose.
- lghh 6y agoWhy does it being compiled defeat the purpose?
- jfkebwjsbx 6y agoThe point of scripts is to easily automate tasks without the need for a heavy infrastructure behind them in the target. If you have to install/run a pipeline every time you modify them (like C or Rust or Go or TypeScript), or you need to sort out distribution (if you use binaries compiled in another machine), or it takes a long time to compile & run (like Rust or C++), or you need to install a heavy runtime (like a JVM or .NET or v8), it defeats the purpose.
- earthboundkid 6y agoGo can `go run script.go` without more ceremony than that. But there are other tradeoffs: https://utcc.utoronto.ca/~cks/space/blog/sysadmin/SysadminGoVsPython https://utcc.utoronto.ca/~cks/space/blog/sysadmin/SysadminGo...
- jfkebwjsbx 6y agoThat compiles and then runs the resulting binary, so you still need the Go infrastructure and the latency. Go is without doubt a better candidate for scripting than things like Rust or C++, but it cannot compete with the ubiquitous and featureful Python or built-in Unix tools (even more ubiquitous, but less featureful and quite dated).
- mmargerum 6y ago> Go infrastructure Install go. Just Go > latency Impercetible I've written plenty of bash and python. Go is just better for me, if for no other reason, than the entire SDK is in my head as is the language
- cloverich 6y agoTo be clear, you need the infrastructure the first time you run it. If you run it _more_ than once, it will both start and execute faster than python.
- cloverich 6y ago`go run` is quite comparable to `deno run` and in fact inspired a great many of its details. Deno's standard library is literally built as a copy of Go's standard library. They work the same way in many respects, and with Go's type inference and (effectively) duck typed interfaces... If you are familiar with Go it is probably a more suitable scripting environment than most other languages for... scripting tasks.