https://github.com/datainq/gover
Super simple package to put your git commit hash, version and build timestamp
https://github.com/datainq/gover
Last synced: 8 months ago
JSON representation
Super simple package to put your git commit hash, version and build timestamp
- Host: GitHub
- URL: https://github.com/datainq/gover
- Owner: datainq
- License: mit
- Created: 2019-09-30T11:44:31.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-09-30T12:14:07.000Z (over 6 years ago)
- Last Synced: 2025-01-12T05:27:35.263Z (over 1 year ago)
- Language: Go
- Size: 1.95 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gover
Simple package with public version variables.
## Usage
```
go get github.com/datainq/gover
```
## Compilation
When compiling the code one should specify the version:
```
VERSION=v1.0.0
GIT_COMMIT=$(git rev-list -1 HEAD)
BUILD_DATE=$(date +"%s")
go build -ldflags "-X github.com/datainq/gover.GitCommit=$GIT_COMMIT -X github.com/datainq/gover.BuildTime=$BUILD_DATE -X github.com/datainq/gover.Version=$VERSION" main.go
```
You can import `github.com/datainq/gover` and use it. The most common use case
is to print version at binary startup, help and exit.