forked from sonirico/go-hyperliquid
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
74 lines (54 loc) · 2.38 KB
/
Makefile
File metadata and controls
74 lines (54 loc) · 2.38 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
GOCMD=go
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
GOINSTALL =$(GOCMD) install
GOMOD=$(GOCMD) mod
GOGENERATE=$(GOCMD) generate
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
.PHONY: all test coverage deps generate lint fmt vet check examples help
all: deps generate fmt vet lint test ## Run all development tasks
help: ## Display this help message
@echo "Available targets:"
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " %-15s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
test: ## Run tests (excluding examples)
$(GOTEST) -v -race -failfast $(shell go list ./... | grep -v examples)
test-verbose: ## Run tests with verbose output
$(GOTEST) -v -race ./...
test-short: ## Run short tests only
$(GOTEST) -short $(shell go list ./... | grep -v examples)
coverage: ## Run tests with coverage
$(GOTEST) -race -coverprofile=coverage.out -covermode=atomic $(shell go list ./... | grep -v examples)
$(GOCMD) tool cover -html=coverage.out -o coverage.html
@echo "Coverage report generated: coverage.html"
clean-coverage: ## Clean coverage files
rm -f coverage.out coverage.html
coverage-func: ## Show coverage by function
$(GOTEST) -race -coverprofile=coverage.out -covermode=atomic $(shell go list ./... | grep -v examples)
$(GOCMD) tool cover -func=coverage.out
examples: ## Run example tests
$(GOTEST) -v ./examples/...
deps: ## Download dependencies
$(GOMOD) download
$(GOMOD) tidy
deps-update: ## Update dependencies
$(GOGET) -u ./...
$(GOMOD) tidy
generate: ## Run go generate
$(GOGENERATE) ./...
lint: ## Run golangci-lint
@which golangci-lint > /dev/null || (echo "golangci-lint not found. Install it with: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest" && exit 1)
golangci-lint run
fmt: ## Format code
@find . -name "*.go" -not -name "*_easyjson.go" | xargs gofmt -s -w
@find . -name "*.go" -not -name "*_easyjson.go" | xargs goimports -w
@find . -name "*.go" -not -name "*_easyjson.go" | xargs golines -w
vet: ## Run go vet
$(GOCMD) vet ./...
check: fmt vet lint ## Run all checks (format, vet, lint)
mod-verify: ## Verify dependencies
$(GOMOD) verify
install-tools: ## Install development tools
$(GOINSTALL) github.com/mailru/easyjson/easyjson@latest
$(GOINSTALL) github.com/golangci/golangci-lint/cmd/golangci-lint@latest
$(GOINSTALL) golang.org/x/tools/cmd/goimports@latest
$(GOINSTALL) github.com/segmentio/golines@latest