Template programming in Go allows the end user to write Go templates that produce, manipulate, and run Go programs. Go has clear, static dependencies, which assist with metaprogramming. Template programming in Go, including generated binaries, CLI tooling, and templating libraries, are all core tenets of the language that help us write maintainable, scalable, performant Go code.
In this chapter, we'll cover the following topics:
- Go generate
- Protobuf code generation
- Linking toolchains
- Configuration metaprogramming using Cobra and Viper
- Text and HTML templating
- Sprig for Go templating
All of these topics will help you write Go code faster and more effectively. In the next section, we'll talk about Go generate and how it is useful in the Go programming language.