https://github.com/haormj/version
go version, inspired by github.com/g4zhuj/version-management-example
https://github.com/haormj/version
Last synced: 3 months ago
JSON representation
go version, inspired by github.com/g4zhuj/version-management-example
- Host: GitHub
- URL: https://github.com/haormj/version
- Owner: haormj
- License: apache-2.0
- Created: 2020-07-07T21:45:19.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-07-07T21:59:22.000Z (almost 5 years ago)
- Last Synced: 2025-01-13T20:15:11.763Z (5 months ago)
- Language: Go
- Size: 5.86 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## version
golang binary with version information, inspired by github.com/g4zhuj/version-management-example
### Usage
```makefile
# variable
binaryName=
versionPath=github.com/haormj/version
version=v0.1.0
outputPath=_outputall: build
build:
@buildTime=`date "+%Y-%m-%d %H:%M:%S"`; \
go build -ldflags "-X '${versionPath}.Version=${version}' \
-X '${versionPath}.BuildTime=$$buildTime' \
-X '${versionPath}.GoVersion=`go version`' \
-X '${versionPath}.GitCommit=`git rev-parse --short HEAD`'" -o ${outputPath}/${binaryName};clean:
rm -rf _output
rm -rf logs.PHONY: all build clean
```