1
0
Fork 0
mirror of https://github.com/eosswedenorg/antelope-api-healthcheck synced 2026-07-02 11:43:42 +02:00

src/main.go: use a global variable to display version number, this should be set by the linker during build.

This commit is contained in:
Henrik Hautakoski 2022-08-21 20:46:40 +02:00
parent 53bc1cfbd8
commit b67b5d6b7e
No known key found for this signature in database
GPG key ID: 608414D93E862CCD

View file

@ -1,6 +1,7 @@
package main package main
import ( import (
"fmt"
"os" "os"
"os/signal" "os/signal"
"syscall" "syscall"
@ -18,6 +19,10 @@ var pidFile string
// Global variables // Global variables
// --------------------------------------------------------- // ---------------------------------------------------------
// Version string, should be updated by the go linker (by passing "-X main.VersionString=value" to the linker)
// see: https://pkg.go.dev/cmd/link and
var VersionString string = "-"
// File descriptor to the current log file. // File descriptor to the current log file.
var logfd *os.File var logfd *os.File
@ -135,7 +140,7 @@ func main() {
} }
if version { if version {
print("Version: v1.2.2\n") fmt.Printf("Version: %s\n", VersionString)
return; return;
} }