forked from tuannvm/slack-mcp-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
77 lines (61 loc) · 1.24 KB
/
Makefile
File metadata and controls
77 lines (61 loc) · 1.24 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
75
76
77
.PHONY: build test lint fmt clean run vet
# Get repository name for binary name
REPO_NAME=$(shell basename $(shell git rev-parse --show-toplevel))
BINARY_NAME=$(REPO_NAME)
BUILD_DIR=./bin
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
GOVET=$(GOCMD) vet
GOFMT=gofmt -s -d
GOLINT=golangci-lint
# Build the binary
build:
mkdir -p $(BUILD_DIR)
$(GOBUILD) -o $(BUILD_DIR)/$(BINARY_NAME) ./cmd/
# Run the binary
run: build
$(BUILD_DIR)/$(BINARY_NAME)
# Clean build artifacts
clean:
$(GOCLEAN)
rm -rf $(BUILD_DIR)
# Run tests
test:
$(GOTEST) -v ./...
# Check code format
fmt:
$(GOFMT) .
# Apply code formatting changes
fmt-write:
gofmt -s -w .
# Run go vet
vet:
$(GOVET) ./...
# Run linter
lint:
go fmt ./...
$(GOLINT) run ./...
# Check all (format, lint, vet, test)
check: fmt lint vet test
# Install dependencies
deps:
$(GOGET) -v ./...
go mod tidy
# Update dependencies
deps-update:
go get -u ./...
go mod tidy
# Build Docker image
docker-build:
docker build -t $(BINARY_NAME):latest .
# Default target
all: clean build
# Print current configuration
info:
@echo "Repository name: $(REPO_NAME)"
@echo "Binary name: $(BINARY_NAME)"
@echo "Build directory: $(BUILD_DIR)"