-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
38 lines (28 loc) · 954 Bytes
/
Makefile
File metadata and controls
38 lines (28 loc) · 954 Bytes
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
38
BINARY := lpagent
MODULE := github.com/lpagent/cli
VERSION_PKG := $(MODULE)/internal/version
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo "none")
DATE := $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
LDFLAGS := -s -w \
-X $(VERSION_PKG).Version=$(VERSION) \
-X $(VERSION_PKG).Commit=$(COMMIT) \
-X $(VERSION_PKG).Date=$(DATE)
.PHONY: build install test fmt vet lint clean
build:
CGO_ENABLED=0 go build -trimpath -ldflags '$(LDFLAGS)' -o bin/$(BINARY) ./cmd/lpagent
install:
CGO_ENABLED=0 go install -trimpath -ldflags '$(LDFLAGS)' ./cmd/lpagent
test:
go test ./...
fmt:
gofmt -w .
vet:
go vet ./...
lint: vet
@which golangci-lint >/dev/null 2>&1 || echo "Install golangci-lint: https://golangci-lint.run/usage/install/"
golangci-lint run ./...
clean:
rm -rf bin/
check: fmt vet test
@echo "All checks passed."