Skip to main content

control.rip

Tag: go

Compile time options in Go applications

Making software features and functionality configurable improves the quality of both the code base and the end product. This can aid in debugging, increase code maintainability, and make code more testable. Sometimes, however, you may not want configuration parameters to change after compilation. Many programming languages provide patterns for this. Let’s take a look at a simple pattern for compile time options in Go applications using build tags and the cmd/ project structure.