1
0

Implemented a package for storing program's version.

This commit is contained in:
Alexander Andreev 2024-07-02 04:12:26 +04:00
parent 23b570c4e5
commit cdabb77c39
Signed by: Arav
GPG Key ID: 25969B23DCB5CA34
3 changed files with 11 additions and 5 deletions

View File

@ -5,10 +5,10 @@ SYSDDIR=${SYSDDIR_:/%=%}
DESTDIR:=
PREFIX:=/usr/local
VERSION=24.27.0
VERSION?=24.27.0
FLAGS:=-buildmode=pie -modcacherw -mod=readonly -trimpath
LDFLAGS=-ldflags "-s -w -X main.version=${VERSION}" -tags osusergo,netgo
LDFLAGS=-ldflags "-s -w -X 'git.arav.su/Arav/dwelling-home/internal/version.ver=v${VERSION}'" -tags osusergo,netgo
.PHONY: run install uninstall clean

View File

@ -12,6 +12,7 @@ import (
"time"
dwhttp "git.arav.su/Arav/dwelling-home/internal/http"
"git.arav.su/Arav/dwelling-home/internal/version"
mfsqlite "git.arav.su/Arav/dwelling-home/pkg/mindflow/database/sqlite"
"git.arav.su/Arav/dwelling-home/web"
"git.arav.su/Arav/httpr"
@ -19,8 +20,6 @@ import (
"github.com/a-h/templ"
)
var version string
var (
showVersion = flag.Bool("v", false, "show version")
listenAddress = flag.String("listen", "/var/run/dwelling-home/sock", "listen address (ip:port|unix_path)")
@ -34,7 +33,7 @@ func main() {
flag.Parse()
if *showVersion {
fmt.Println("dwelling-home Ver.", version, "\nCopyright (c) 2023 Alexander \"Arav\" Andreev <me@arav.su>")
fmt.Println("dwelling-home", version.GetVersion(), "\nCopyright (c) 2023,2024 Alexander \"Arav\" Andreev <me@arav.su>")
return
}

View File

@ -0,0 +1,7 @@
package version
var ver string
func GetVersion() string {
return ver
}