forked from openclaw/gogcli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
42 lines (31 loc) · 892 Bytes
/
Copy pathMakefile
File metadata and controls
42 lines (31 loc) · 892 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
38
39
40
41
42
SHELL := /bin/bash
# `make` should build the binary by default.
.DEFAULT_GOAL := build
.PHONY: build fmt fmt-check lint test ci tools
BIN_DIR := $(CURDIR)/bin
BIN := $(BIN_DIR)/gog
CMD := ./cmd/gog
TOOLS_DIR := $(CURDIR)/.tools
GOFUMPT := $(TOOLS_DIR)/gofumpt
GOIMPORTS := $(TOOLS_DIR)/goimports
GOLANGCI_LINT := $(TOOLS_DIR)/golangci-lint
build:
@mkdir -p $(BIN_DIR)
@go build -o $(BIN) $(CMD)
tools:
@mkdir -p $(TOOLS_DIR)
@GOBIN=$(TOOLS_DIR) go install mvdan.cc/gofumpt@v0.9.2
@GOBIN=$(TOOLS_DIR) go install golang.org/x/tools/cmd/goimports@v0.40.0
@GOBIN=$(TOOLS_DIR) go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.64.8
fmt: tools
@$(GOIMPORTS) -w .
@$(GOFUMPT) -w .
fmt-check: tools
@$(GOIMPORTS) -w .
@$(GOFUMPT) -w .
@git diff --exit-code -- '*.go' go.mod go.sum
lint: tools
@$(GOLANGCI_LINT) run
test:
@go test ./...
ci: fmt-check lint test