mirror of
https://github.com/nonoo/kappanhang.git
synced 2025-12-06 08:02:00 +01:00
Add git hash/tag to the about string
This commit is contained in:
parent
18b6e1f827
commit
45b1076b78
2
.vscode/tasks.json
vendored
2
.vscode/tasks.json
vendored
|
|
@ -4,7 +4,7 @@
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"tasks": [
|
"tasks": [
|
||||||
{
|
{
|
||||||
"label": "debug",
|
"label": "build",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": "build/build.sh",
|
"command": "build/build.sh",
|
||||||
"problemMatcher": [],
|
"problemMatcher": [],
|
||||||
|
|
|
||||||
|
|
@ -11,4 +11,6 @@ scriptdir=`pwd`
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
go build
|
git_tag=`git describe --exact-match HEAD 2>/dev/null`
|
||||||
|
git_hash=`git log --pretty=format:'%h' -n 1`
|
||||||
|
go build -ldflags "-X main.gitTag=$git_tag -X main.gitHash=$git_hash"
|
||||||
|
|
|
||||||
13
main.go
13
main.go
|
|
@ -8,10 +8,21 @@ import (
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var gitTag string
|
||||||
|
var gitHash string
|
||||||
|
|
||||||
var gotErrChan = make(chan bool)
|
var gotErrChan = make(chan bool)
|
||||||
|
|
||||||
func getAboutStr() string {
|
func getAboutStr() string {
|
||||||
return "kappanhang by Norbert Varga HA2NON and Akos Marton ES1AKOS https://github.com/nonoo/kappanhang"
|
var v string
|
||||||
|
if gitTag != "" {
|
||||||
|
v = gitTag
|
||||||
|
} else if gitHash != "" {
|
||||||
|
v = gitTag
|
||||||
|
} else {
|
||||||
|
v = "debug"
|
||||||
|
}
|
||||||
|
return "kappanhang " + v + " by Norbert Varga HA2NON and Akos Marton ES1AKOS https://github.com/nonoo/kappanhang"
|
||||||
}
|
}
|
||||||
|
|
||||||
func runControlStream(osSignal chan os.Signal) (shouldExit bool, exitCode int) {
|
func runControlStream(osSignal chan os.Signal) (shouldExit bool, exitCode int) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue