-
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
include version and commit hash at compile time
when using makefile, version is set to "git". Currently printed on start, but an about page in the web UI will be added.
- Loading branch information
Showing
5 changed files
with
28 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,4 @@ jfa-go | |
build/ | ||
pkg/ | ||
old/ | ||
version.go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import subprocess | ||
import sys | ||
import os | ||
try: | ||
version = sys.argv[1].replace('v', '') | ||
except IndexError: | ||
version = "git" | ||
|
||
commit = subprocess.check_output("git rev-parse --short HEAD".split()).decode("utf-8").rstrip() | ||
|
||
file = f'package main; const VERSION = "{version}"; const COMMIT = "{commit}";' | ||
|
||
try: | ||
writeto = sys.argv[2] | ||
except IndexError: | ||
writeto = "version.go" | ||
|
||
with open(writeto, 'w') as f: | ||
f.write(file) | ||
|