diff options
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | main.go | 2 | ||||
-rw-r--r-- | server.go | 2 | ||||
-rw-r--r-- | version.go | 4 |
4 files changed, 6 insertions, 6 deletions
@@ -7,11 +7,11 @@ VERSION := $(shell git describe --dirty --always) all: $(BUILD_DIR)/$(TARGET_EXEC) $(BUILD_DIR)/$(TARGET_EXEC): - go build -ldflags "-X main.gitDescribe=$(VERSION)" -o $@ $(MODULE_NAME) + go build -ldflags "-X main.version=$(VERSION)" -o $@ $(MODULE_NAME) .PHONY: debug debug: - go run -ldflags "-X main.gitDescribe=$(VERSION)" $(MODULE_NAME) + go run -ldflags "-X main.version=$(VERSION)" $(MODULE_NAME) .PHONY: clean clean: @@ -16,7 +16,7 @@ func main() { flag.Parse() if printVersion { - fmt.Println(gitDescribe) + fmt.Println(version) os.Exit(0) } @@ -25,7 +25,7 @@ func NewServer(addr string) Server { r.PathPrefix("/static/"). Handler(http.StripPrefix("/static/", http.FileServer(http.FS(static)))) - r.HandleFunc("/version", view.VersionRead(gitDescribe)).Methods(`GET`) + r.HandleFunc("/version", view.VersionRead(version)).Methods(`GET`) r.HandleFunc("/recipes", view.RecipesRead).Methods(`GET`) @@ -4,10 +4,10 @@ import ( "log" ) -var gitDescribe string +var version string func init() { - if gitDescribe == "" { + if version == "" { log.Fatal("No version information passed to this via build flags") } } |