Skip to content

Commit d522338

Browse files
codeshaineccojocar
authored andcommitted
update: updated the build command to include version metadata
1 parent 270b5ce commit d522338

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ GINKGO ?= $(GOBIN)/ginkgo
1818
GO_MINOR_VERSION = $(shell $(GO) version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f2)
1919
GOVULN_MIN_VERSION = 17
2020
GO_VERSION = 1.23
21+
LDFLAGS = -ldflags "\
22+
-X 'main.Version=$(shell git describe --tags --always)' \
23+
-X 'main.GitTag=$(shell git describe --tags --abbrev=0)' \
24+
-X 'main.BuildDate=$(shell date -u +%Y-%m-%dT%H:%M:%SZ)'"
2125

2226
default:
2327
$(MAKE) build
@@ -62,10 +66,10 @@ test-coverage: install-test-deps
6266
go test -race -v -count=1 -coverprofile=coverage.out ./...
6367

6468
build:
65-
go build -o $(BIN) ./cmd/gosec/
69+
go build $(LDFLAGS) -o $(BIN) ./cmd/gosec/
6670

6771
build-race:
68-
go build -race -o $(BIN) ./cmd/gosec/
72+
go build -race $(LDFLAGS) -o $(BIN) ./cmd/gosec/
6973

7074
clean:
7175
rm -rf build vendor dist coverage.out

0 commit comments

Comments
 (0)