-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
36 lines (26 loc) · 844 Bytes
/
Copy pathMakefile
File metadata and controls
36 lines (26 loc) · 844 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
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 := -X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.date=$(DATE)
BINARY := uploadcare
GOFILES := $(shell find . -name '*.go' -not -path './dist/*' -not -path './bin/*')
.PHONY: build test lint fmt fmt-check clean release-snapshot
build:
go build -ldflags "$(LDFLAGS)" -o bin/$(BINARY) ./cmd/uploadcare
test:
go test ./...
lint:
golangci-lint run ./...
fmt:
gofmt -w $(GOFILES)
fmt-check:
@files="$$(gofmt -l $(GOFILES))"; \
if [ -n "$$files" ]; then \
echo "gofmt required for:"; \
echo "$$files"; \
exit 1; \
fi
clean:
rm -rf bin/ dist/
release-snapshot:
goreleaser release --snapshot --clean