Go provides straightforward, first class support for compiling programs to small [^1], static executable binaries [^2], often just called *commands*.
Go also provides the ability to *embed files* into compiled binaries [^3], such as:
* Templates
* Resources (for example, web application assets, like HTML, CSS, JavaScript, and images)
* Scripts (such as data migration and transformation scripts)
Go is a simple, concise programming language with a robust standard library with excellent system and network support that greatly reduces the need for third party packages. This makes Go particularly adept for building reliable automation tools.
The snippets in the rest of this chapter provide a quick orientation to Go focused on highlighting the features typically needed for programming useful tool commands.
---
Next: [[2. The main package]]
[^1]: Small is relative; compiled Go commands will be larger than their compiled C and C++ counterparts because Go links a runtime that includes, among other things, a garbage collector (eliminating a common class of programming bugs).
[^2]: Go commands are statically linked, but that doesn't mean they're completely isolated from the host operating system environment. For example, you can't ([without some effort](https://github.com/tinygo-org/tinygo)) target bare metal, but you can target `scratch` containers, which only have a Linux kernel). For specific target architecture/environments, see: https://go.dev/wiki/MinimumRequirements.
[^3]: This means, for practical intents and purposes, that Go commands are *hermetically sealed and self-contained*, easy to distribute and use on target systems. There is no need to install a language runtime environment, libraries, or even other application resources if a fully self-contained command is desired. This not only simplifies deployment, it also simplifies avoiding conflicts with dependencies required by other programs on the host system. See: https://pkg.go.dev/embed.