Remix.run Logo
wltr 10 hours ago

Been doing bash scripting for years. Tried Go recently, on my, it’s so much better for everything OS scripting. I regret I haven’t started with Go years ago. All my scripts are rewritten to Go. I kept only a handful, those that are just a few lines and no logic.

hugodan 10 hours ago | parent | next [-]

I regret not going with bash or even sh when I had the chance. Nothing beats that for ubiquity and getting shit done.

Go is behind, specifically, you have no guarantees that a given machine has Go installed, and doing stuff like gluing commands together, inspecting some files, pipe output around, or automate the boring thing in 30 seconds.

Sure Go beats bash or sh when the thing you are doing starts to become real software, but that is a problem that sits between the chair and the keyboard.

transmit101 8 hours ago | parent | prev | next [-]

Having explicit and unavoidable error handling (which Go of course has in spades) is a particular improvement when writing/replacing Bash scripts.

soupbowl 10 hours ago | parent | prev [-]

Are you using 'go run' or compiling these scripts? Just curious about what you are up to as I was considering moving my scripts from bash to go.

transmit101 8 hours ago | parent [-]

Not sure if it's obvious, but "go run" is just a thin wrapper around "go build" which compiles your Go code to a temporary location and then runs it in a single step.