diff --git a/Makefile b/Makefile index 5ec6dd4..3f2da41 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,7 @@ frontend-build: install-deps .PHONY: run-backend run-backend: @echo "→ Running backend..." - CGO_ENABLED=0 go run -ldflags="-s -w -X 'main.buildString=${BUILDSTR}' -X 'main.versionString=${VERSION}' -X 'main.frontendDir=frontend/dist'" cmd/*.go + CGO_ENABLED=0 go run -ldflags="-s -w -X 'main.buildString=${BUILDSTR}' -X 'main.versionString=${VERSION}' -X 'github.com/abhinavxd/libredesk/internal/version.Version=${VERSION}' -X 'main.frontendDir=frontend/dist'" cmd/*.go # Run the JS frontend server in development mode. .PHONY: run-frontend @@ -52,8 +52,8 @@ run-frontend: .PHONY: build-backend build-backend: $(STUFFBIN) @echo "→ Building backend..." - @CGO_ENABLED=0 go build -a\ - -ldflags="-X 'main.buildString=${BUILDSTR}' -X 'main.versionString=${VERSION}' -s -w" \ + @CGO_ENABLED=0 go build -a \ + -ldflags="-X 'main.buildString=${BUILDSTR}' -X 'main.versionString=${VERSION}' -X 'github.com/abhinavxd/libredesk/internal/version.Version=${VERSION}' -s -w" \ -o ${BIN} cmd/*.go # Main build target: builds both frontend and backend, then stuffs static assets into the binary. diff --git a/internal/version/version.go b/internal/version/version.go new file mode 100644 index 0000000..0fe0a92 --- /dev/null +++ b/internal/version/version.go @@ -0,0 +1,5 @@ +package version + +// Version holds the current version of the application. +// This value is intended to be set at build time using the -X linker flag. +var Version = "unknown-version"