feat: makefile, git version number
This commit is contained in:
@@ -82,8 +82,10 @@ vendor:
|
|||||||
#
|
#
|
||||||
# ==================================================================================== #
|
# ==================================================================================== #
|
||||||
|
|
||||||
current_time = $(shell date -u +"%Y-%m-%dT%H:%M:%S%z")
|
current_time = $(shell date --iso-8601=seconds)
|
||||||
linker_flags = '-s -X main.buildTime=${current_time}'
|
git_description = $(shell git describe --always --dirty)
|
||||||
|
linker_flags = '-s -X main.buildTime=${current_time} -X main.version=${git_description}
|
||||||
|
|
||||||
|
|
||||||
## build/api: build the cmd/api application
|
## build/api: build the cmd/api application
|
||||||
.PHONY: build/api
|
.PHONY: build/api
|
||||||
|
|||||||
@@ -19,14 +19,10 @@ import (
|
|||||||
"greenlight.debuggingjon.dev/internal/mailer"
|
"greenlight.debuggingjon.dev/internal/mailer"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Declare a string containing the application version number. Later in the book we'll
|
var (
|
||||||
// generate this automatically at build time, but for now we'll just store the version
|
buildTime string
|
||||||
// number as a hard-coded global constant.
|
version string
|
||||||
const version = "1.0.0"
|
)
|
||||||
|
|
||||||
// Create a buildTime variable to hold the executable binary build time. Note that this
|
|
||||||
// must be a string type, as the -X linker flag will only work with string variables.
|
|
||||||
var buildTime string
|
|
||||||
|
|
||||||
// Define a config struct to hold all the configuration settings for our application.
|
// Define a config struct to hold all the configuration settings for our application.
|
||||||
// For now, the only configuration settings will be the network port that we want the
|
// For now, the only configuration settings will be the network port that we want the
|
||||||
|
|||||||
Reference in New Issue
Block a user