From fd2667cb9f6fe15c1770b82372007524aadb1cf0 Mon Sep 17 00:00:00 2001 From: nytpu Date: Mon, 19 Apr 2021 10:16:20 -0600 Subject: move Version and Commit to core --- Makefile | 2 +- comitium.go | 2 +- core/entries.go | 6 ++++-- core/version.go | 11 +++++++++++ version.go | 11 ----------- 5 files changed, 17 insertions(+), 15 deletions(-) create mode 100644 core/version.go delete mode 100644 version.go diff --git a/Makefile b/Makefile index aab57cd..6ff5b6c 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ GO ?= CGO_ENABLED=0 go GOFLAGS ?= #GOLDFLAGS ?= -X main.Version=$(VERSION) -X main.Commit=$(COMMIT) # also strips executable, significantly reduces size -GOLDFLAGS ?= -s -w -X main.Version=$(VERSION) -X main.Commit=$(COMMIT) +GOLDFLAGS ?= -s -w -X golang.nytpu.com/comitium/core.Version=$(VERSION) -X golang.nytpu.com/comitium/core.Commit=$(COMMIT) SCDOC ?= scdoc MKDIR ?= mkdir -p RM ?= rm -f diff --git a/comitium.go b/comitium.go index 2126956..41cd616 100644 --- a/comitium.go +++ b/comitium.go @@ -27,7 +27,7 @@ func main() { os.Exit(0) } if os.Args[1] == "version" { - fmt.Printf("comitium v%v, commit %v\n", Version, Commit) + fmt.Printf("comitium v%v, commit %v\n", core.Version, core.Commit) os.Exit(0) } diff --git a/core/entries.go b/core/entries.go index b1b5c05..f0b0046 100644 --- a/core/entries.go +++ b/core/entries.go @@ -156,12 +156,14 @@ func (d *FullData) WriteFeed(dataPath string) error { } } - rawPage += ` + rawPage += fmt.Sprintf(` --- => https://git.nytpu.com/comitium/about/ aggregated using comitium -` +`, + Version, + ) err := ioutil.WriteFile(path, []byte(rawPage), 0666) if err != nil { diff --git a/core/version.go b/core/version.go new file mode 100644 index 0000000..45d8ab5 --- /dev/null +++ b/core/version.go @@ -0,0 +1,11 @@ +// Copyright (C) 2021 nytpu +// SPDX-License-Identifier: AGPL-3.0-only +// For more license details, see LICENSE or . + +package core + +// These variables are set by the linker. They can be modified in the Makefile. +var ( + Version = "Unknown" + Commit = "Unknown" +) diff --git a/version.go b/version.go deleted file mode 100644 index 113d5f6..0000000 --- a/version.go +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (C) 2021 nytpu -// SPDX-License-Identifier: AGPL-3.0-only -// For more license details, see LICENSE or . - -package main - -// These variables are set by the linker. They can be modified in the Makefile. -var ( - Version = "Unknown" - Commit = "Unknown" -) -- cgit v1.2.3