https://github.com/asauber/go-git-revision
Embed your git revision into your go binaries
https://github.com/asauber/go-git-revision
Last synced: 3 months ago
JSON representation
Embed your git revision into your go binaries
- Host: GitHub
- URL: https://github.com/asauber/go-git-revision
- Owner: asauber
- License: mit
- Created: 2019-07-19T20:07:55.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-07-20T03:02:56.000Z (almost 6 years ago)
- Last Synced: 2025-01-01T15:21:46.228Z (5 months ago)
- Language: Shell
- Size: 1.02 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## go git revision
This project contains an example of how to embed a git revision into your go binaries.
This is useful for debugging. Try it out in your own go projects!
### Why and how
This embeds the current git commit hash into your go binary as a static string, and prints it upon startup, so that at any time in the future you can relate the binary or its output to a specific git revision.
### To build
```
make
```### To run
```
$ make run
Starting up with git revision da159998f0ce
```Edit or add a file to the directory then,
```
$ touch newfile
$ make run
Starting up with git revision da159998f0ce-dirty
```