-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
37 lines (31 loc) · 967 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# go build -ldflags "-X main.build=`git rev-parse HEAD`
LDFLAGS := -s -w
VERSION := 1.0.0
BUILD_DATE := $(shell date +%Y-%m-%dT%H:%M:%S)
GIT_COMMIT := $(shell git rev-parse --short HEAD) $(shell git log -1 --pretty=%s)
# build: build the project
build:
@env CGO_ENABLED=0 \
go build -trimpath \
-ldflags "$(LDFLAGS) \
-X 'eduData/bootstrap.Version=$(VERSION)' \
-X 'eduData/bootstrap.BuildDate=$(BUILD_DATE)' \
-X 'eduData/bootstrap.GitCommit=$(GIT_COMMIT)'" \
.
# cbuild: cross build for Linux amd64
cbuild:
@env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build -trimpath \
-ldflags "$(LDFLAGS) \
-X 'eduData/bootstrap.Version=$(VERSION)' \
-X 'eduData/bootstrap.BuildDate=$(BUILD_DATE)' \
-X 'eduData/bootstrap.GitCommit=$(GIT_COMMIT)'" \
.
# debug: debug
debug:
@brew services start postgresql@17
@CompileDaemon -build="make build" -command="./eduData --debug"
check:
gofumpt -l -w .
golangci-lint run
.PHONY: build cbuild check