https://github.com/iac-factory/example-go-versioning
Example go project that compiles version information at binary build.
https://github.com/iac-factory/example-go-versioning
Last synced: 2 months ago
JSON representation
Example go project that compiles version information at binary build.
- Host: GitHub
- URL: https://github.com/iac-factory/example-go-versioning
- Owner: iac-factory
- License: bsd-3-clause
- Created: 2024-05-02T22:56:38.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-02T23:25:20.000Z (about 1 year ago)
- Last Synced: 2025-02-08T17:44:56.027Z (4 months ago)
- Language: Makefile
- Size: 9.77 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# example-go-versioning
Example go project that compiles version information at binary build.
## Overview
The following program demonstrates *dynamic-linking* of a runtime variable `VERSION`. By default, via `go run .`,
the `main.VERSION` variable will be assigned to `"development"`.However, when building with the following command:
```bash
go build --mod vendor --ldflags="-s -w -X 'main.VERSION=$(cat VERSION)'" -o /example-go-versioning
```The `main.VERSION` variable is updated according to the output of the VERSION file.
For demonstration, locally clone the repository and execute:
```bash
make run
```