Skip to content
Permalink
Browse files

(version): Get the version from Makefile

  • Loading branch information
erbesharat committed Jan 7, 2020
1 parent f1e774d commit 0a5f848c3ae96a8c132958604055011873cd29e0
Showing with 11 additions and 7 deletions.
  1. +3 −2 Makefile
  2. +1 −1 VERSION
  3. +7 −4 txtdirectmain/version.go
@@ -1,7 +1,8 @@
BIN := txtdirect
DOMAIN := c.txtdirect.org
VERSION := 0.4.0
VERSION := $(shell cat ./VERSION)
IMAGE := $(DOMAIN)/$(BIN):$(VERSION)
CODEPATH := $(shell go list -m)

BUILD_GOOS := $(if $(GOOS),$(GOOS),linux)
BUILD_GOARCH := $(if $(GOARCH),$(GOARCH),amd64)
@@ -12,7 +13,7 @@ CONTAINER ?= $(BIN)

build:
cd cmd/txtdirect && \
GO111MODULE=on CGO_ENABLED=0 GOARCH=$(BUILD_GOARCH) GOOS=$(BUILD_GOOS) go build -ldflags="-s -w"
GO111MODULE=on CGO_ENABLED=0 GOARCH=$(BUILD_GOARCH) GOOS=$(BUILD_GOOS) go build -ldflags="-s -w -X $(CODEPATH)/txtdirectmain.TXTDirectVersion=$(VERSION)"
mv cmd/txtdirect/txtdirect ./$(BIN)

test:
@@ -1 +1 @@
v0.2.0
v0.4.0-beta
@@ -1,8 +1,11 @@
package txtdirectmain

// Various CoreDNS constants.
// Various TXTDirect constants.
const (
TXTDirectVersion = "0.4.0"
TXTDirectName = "TXTDirect"
serverType = "http"
TXTDirectName = "TXTDirect"
serverType = "http"
)

// TXTDirectVersion gets filled in the build time using -ldflags
// Check the Makefile for more information.
var TXTDirectVersion = ""

0 comments on commit 0a5f848

Please sign in to comment.
You can’t perform that action at this time.