From 4bd7343a479b925d355d7543a177ff92b721c6d5 Mon Sep 17 00:00:00 2001 From: Dylan Ravel Date: Mon, 22 Dec 2025 00:16:43 -0700 Subject: [PATCH] Add instructions for building with version info Added a section to CONTRIBUTING.md explaining how to build the project with version information injected using Go build flags. This helps contributors test version display and verify version injection locally. --- CONTRIBUTING.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1634401..8d9f289 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -37,6 +37,28 @@ go build -o tmpo . ./tmpo --help ``` +### Building with Version Information + +To build with version information injected (useful for testing version display): + +```bash +go build -ldflags "-X github.com/DylanDevelops/tmpo/cmd/utilities.Version=0.1.0 \ + -X github.com/DylanDevelops/tmpo/cmd/utilities.Commit=$(git rev-parse --short HEAD) \ + -X github.com/DylanDevelops/tmpo/cmd/utilities.Date=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \ + -o tmpo . +``` + +> [!NOTE] +> This is an example - you can modify the version number (e.g., `0.1.0`) or any other injected values to suit your testing needs. + +This is useful when you want to: + +- Test version display locally (`./tmpo --version`) +- Build a binary with specific version info +- Verify version injection is working correctly + +For production releases, goreleaser handles version injection automatically. + ### Testing ```bash