-
Notifications
You must be signed in to change notification settings - Fork 57
/
Makefile
27 lines (19 loc) · 648 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
.PHONY: build test test-vet docker clean lint
TARGET=escalator
SRC_DIRS=pkg cmd
SOURCES=$(shell for dir in $(SRC_DIRS); do if [ -d $$dir ]; then find $$dir -type f -iname '*.go'; fi; done)
ENVVAR ?= CGO_ENABLED=0
ARCH=$(if $(TARGETPLATFORM),$(lastword $(subst /, ,$(TARGETPLATFORM))),amd64)
$(TARGET): $(SOURCES)
$(ENVVAR) GOARCH=$(ARCH) go build -a -installsuffix cgo -o $(TARGET) cmd/main.go
build: $(TARGET)
test:
go test ./... -cover -race
test-vet:
go vet ./...
docker: Dockerfile
docker buildx build --build-arg ENVVAR="$(ENVVAR)" -t atlassian/escalator --platform linux/$(ARCH) .
clean:
rm -f $(TARGET)
lint:
golangci-lint run