codefionn

Go is a great scripting language

TL;DR Go is a great scripting language if you require more than a shell language.

I recently had to write a Dockerfile generator for caching automatic testing runs and incrementally caching the build without an actual incremental build in CICD.

Flow: XML project files go into main.go, run with go run, which writes a Dockerfile that the CI build runs as cached layers for dependencies, build and tests
The job: turn project files into a Dockerfile whose layers CI can cache

Previously this generator was written in bash and powershell.

Required features for the choosen language were:

The following languages/runtimes were in the running for this task:

Deno, Lua and Python require external packages for parsing xml files. Deno would be easier, because external dependencies can simply be imported with just an URL. Nushell has problems parsing certain xml files. Go on the other hand has xml parsing builtin.

Go is also simple to run with go run main.go, doesn't require auxillary files (like packages.json with npm), but can also be compiled and cached. Also, Go is trivally multi-threaded, which is a big problem in many interpreted languages.