forked from anilcse/CosmoScope
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
51 lines (40 loc) · 1.11 KB
/
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
.PHONY: all build test clean lint coverage dev-deps
# Variables
BINARY_NAME=cosmoscope
MAIN_PACKAGE=./cmd/cosmoscope
GO_FILES=$(shell find . -type f -name '*.go')
VERSION=$(shell git describe --tags --always --dirty)
LDFLAGS=-ldflags "-X main.version=${VERSION}"
GOLANGCI_LINT_VERSION=v1.55.2
all: lint test build
build:
go build ${LDFLAGS} -o bin/${BINARY_NAME} ${MAIN_PACKAGE}
test:
go test -v -race -coverprofile=coverage.out ./...
clean:
go clean
rm -f bin/${BINARY_NAME}
rm -f coverage.out
lint:
@if ! which golangci-lint >/dev/null; then \
echo "Installing golangci-lint..." && \
go install github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCI_LINT_VERSION}; \
fi
golangci-lint run
coverage: test
go tool cover -html=coverage.out
# Install development dependencies
dev-deps:
go install github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCI_LINT_VERSION}
# Run the application
run: build
./bin/${BINARY_NAME}
# Update dependencies
deps-update:
go mod tidy
go mod verify
# Check tools versions
check-tools:
@echo "Checking tools versions..."
@go version
@golangci-lint --version