Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Go isn’t scripting, it is compiled, which defeats the purpose.


`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.


Why does it being compiled defeat the purpose?


The 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.


Go can `go run script.go` without more ceremony than that. But there are other tradeoffs:

https://utcc.utoronto.ca/~cks/space/blog/sysadmin/SysadminGo...


That 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).


To 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.


> 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




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: