-
Notifications
You must be signed in to change notification settings - Fork 18
/
Makefile
61 lines (45 loc) · 1.49 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
52
53
54
55
56
57
58
59
60
61
GO := go
HAS_GOMODULES := $(shell go help mod why 2> /dev/null)
ifdef HAS_GOMODULES
export GO111MODULE=on
export GOFLAGS = -mod=vendor
else
$(warn vendor import can only be done on go 1.11+ which supports go modules)
endif
.PHONY: all build install clean test format vet golint lint errcheck vendor
# Tools
#
# In module mode, 'go get' has a side-effect of updating the go.mod
# file. We do not want to update go.mod when installing tools.
# As a workaround, when installing a tool, cd to /tmp and turn off
# module mode. This should be solved in:
# https://github.com/golang/go/issues/30515
# https://github.com/golang/go/issues/24250
fetch-tools:
mkdir -p tools
(cd tools && $(GO) install -mod=readonly golang.org/x/lint/golint@v0.0.0-20210508222113-6edffad5e616)
(cd tools && $(GO) install -mod=readonly github.com/kisielk/errcheck@v1.7.0)
(cd tools && $(GO) install -mod=readonly github.com/vbatts/git-validation@v1.2.0)
# Deliverables
fmt:
$(GO) fmt ./... | wc -l | grep 0
vet:
$(GO) vet ./...
test: $(GOPATH)/bin/kind
$(GO) test ./...
git-validation:
git-validation -run DCO,short-subject
lint:
golint `go list ./...`
errcheck:
errcheck -verbose -blank ./...
vendor: vendor-tidy
@echo "Updating vendor tree"
go mod vendor
sed -i '1 i\// +build skipcompile\n' vendor/kubevirt.io/client-go/kubecli/kubevirt_test_utils.go
vendor-tidy:
@echo "Removing unused files in vendor tree"
go mod tidy
$(GOPATH)/bin/kind:
@echo "Installing kind"
go install -mod=readonly sigs.k8s.io/kind@v0.16.0