M Makefile => Makefile +1 -2
@@ 4,10 4,9 @@ SRC != find . -name '*.go' ! -name '*_test.go'
# Force using go's builtin dns resolver, instead of the system one, in order to
# produce a nice, clean, statically-linked executable!
-FLAGS = -tags netgo
+FLAGS = -tags netgo -ldflags="-X main.Version=$(shell git describe --always --dirty --tags)"
$(BINDIR)/$(NAME): $(SRC)
- go generate
go build -o $(BINDIR) $(FLAGS)
all: $(NAME)
M main.go => main.go +1 -11
@@ 4,7 4,6 @@ import (
"bufio"
"crypto/tls"
"crypto/x509"
- _ "embed"
"errors"
"flag"
"fmt"
@@ 14,7 13,6 @@ import (
"net/url"
"os"
"path"
- "strings"
"sync"
"time"
@@ 28,9 26,7 @@ const (
GeminiMaxRequestSize = 1024
)
-//go:generate sh -c "git describe --always --dirty --tags | xargs >version.txt"
-//go:embed version.txt
-var Version string
+var Version = "unknown"
type ErrNotFound struct {
Reason string
@@ 232,12 228,6 @@ func loadCertificates(cfg *hodhod.Config) (certs []tls.Certificate, err error) {
}
func main() {
- if Version == "" {
- Version = "unknown"
- } else {
- Version = strings.TrimSpace(Version)
- }
-
configFile := flag.String("config", "config.json", "Path to config file")
showVersion := flag.Bool("version", false, "Print hodhod version")
flag.Parse()