-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
63 lines (48 loc) · 1.23 KB
/
Makefile
File metadata and controls
63 lines (48 loc) · 1.23 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
default: all
.PHONY: all
all: clean build test check
VERSION := `git describe --abbrev=0 --tags || echo "0.0.0"`
BUILD := `git rev-parse --short HEAD`
LDFLAGS=-ldflags "-X=github.com//anthropics/s5cmd/v2/version.GitCommit=$(BUILD)"
.PHONY: build
build:
@go get ./...
@go build ${GCFLAGS} ${LDFLAGS} -mod=mod .
TEST_TYPE:=test_with_race
ifeq ($(OS),Windows_NT)
TEST_TYPE=test_without_race
endif
.PHONY: test
test: $(TEST_TYPE)
.PHONY: test_with_race
test_with_race:
@S5CMD_BUILD_BINARY_WITHOUT_RACE_FLAG=0 go test -count=1 -race ./...
.PHONY: test_without_race
test_without_race:
@S5CMD_BUILD_BINARY_WITHOUT_RACE_FLAG=1 go test -count=1 ./...
.PHONY: check
check: vet staticcheck check-fmt check-codegen
.PHONY: staticcheck
staticcheck:
@go install honnef.co/go/tools/cmd/staticcheck@2023.1.7
@staticcheck -checks 'all,-ST1000' ./...
.PHONY: vet
vet:
@go vet ./...
.PHONY: check-fmt
check-fmt:
@if [ $$(go fmt ./...) ]; then\
echo "Go code is not formatted";\
exit 1;\
fi
.PHONY: check-codegen
check-codegen: gogenerate ## Check generated code is up-to-date
@git diff --exit-code --
.PHONY: gogenerate
gogenerate:
@go install go.uber.org/mock/mockgen@v0.4.0
@go generate ./...
.PHONY: clean
clean:
@rm -f ./s5cmd
.NOTPARALLEL: