-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmakefile
More file actions
37 lines (28 loc) · 1023 Bytes
/
makefile
File metadata and controls
37 lines (28 loc) · 1023 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
.PHONY: all setup build run lint test
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null | sed 's/^v//')
COMMIT ?= $(shell git rev-parse --short=12 HEAD 2>/dev/null || echo "unknown")
DATE ?= $(shell date -u '+%Y-%m-%dT%H:%M:%SZ')
AMPLITUDE_KEY ?= $(DUNE_CLI_AMPLITUDE_KEY)
LDFLAGS = -s -w \
-X main.version=$(VERSION) \
-X main.commit=$(COMMIT) \
-X main.date=$(DATE) \
-X main.amplitudeKey=$(AMPLITUDE_KEY)
all: lint test build
setup: bin/golangci-lint
go mod download
build: lint
go build -ldflags '$(LDFLAGS)' -o dune-cli ./cmd
run:
go run -ldflags '$(LDFLAGS)' ./cmd $(ARGS)
bin:
mkdir -p bin
bin/golangci-lint: bin
GOBIN=$(PWD)/bin go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.64.8
lint: bin/golangci-lint
go fmt ./...
go vet ./...
bin/golangci-lint -c .golangci.yml run ./...
go mod tidy
test:
go test -timeout=10s -race -cover -bench=. -benchmem ./...