Slawomir Koszewski 3278acb8cb
All checks were successful
Test Workflow / testver (push) Successful in 1m4s
Update Go setup action to version 6 in workflow
2025-12-10 22:32:17 +01:00
2025-12-10 15:05:08 +01:00
2025-12-10 15:05:08 +01:00
2025-12-10 20:48:43 +01:00
2025-12-10 15:05:08 +01:00

Go Application Versioning

This repository contains a simple Go application that demonstrates how to embedded version strings that come from Git tags during the build process.

The version.go source contains a variable named Version that is initialized in the code to undefined string constant. The build command replaces this values with Git tag value optionally suffixed with information about changes since the tag.

The build command uses the -ldflags option of the go build command to set the value of the Version variable at compile time.

go build -o testver -ldflags "-X main.Version=$(VERSION)"

The version is captured using the following command:

VERSION=$(git describe --tags --always)

Use make command to build the application.

Description
This repository shows how to create a simple Go application and embed Git tags into the binary.
Readme 30 KiB
Languages
Makefile 66.8%
Go 33.2%