/
Makefile
62 lines (44 loc) · 1.15 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
62
# Copyright 2019 The Kubernetes Authors.
# SPDX-License-Identifier: Apache-2.0
.PHONY: generate license fix vet fmt test build tidy clean
GOBIN = $(shell go env GOBIN)
ifeq ($(GOBIN),)
GOBIN = $(shell go env GOPATH)/bin
endif
$(GOBIN)/addlicense:
go install github.com/google/addlicense@v1.0.0
$(GOBIN)/golangci-lint:
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.45.2
$(GOBIN)/k8scopy:
( cd ../k8scopy; go install . )
$(GOBIN)/mdtogo:
go get sigs.k8s.io/kustomize/cmd/mdtogo
build:
go build -v -o $(GOBIN)/kubectl-krm ./kubectl-krm
all: build license fix vet fmt test lint tidy
k8sGenDir := internal/commands/internal/k8sgen/pkg
generate: $(GOBIN)/mdtogo $(GOBIN)/k8scopy
GOBIN=$(GOBIN) go generate ./...
clean:
rm -rf $(k8sGenDir)
lint: $(GOBIN)/golangci-lint
$(GOBIN)/golangci-lint \
--skip-dirs $(k8sGenDir) \
run ./... \
--path-prefix=cmd/config \
-c ../../.golangci.yml
license: $(GOBIN)/addlicense
$(GOBIN)/addlicense \
-y 2022 \
-c "The Kubernetes Authors." \
-f LICENSE_TEMPLATE .
test:
go test -v -timeout 45m -cover ./...
fix:
go fix ./...
fmt:
go fmt ./...
tidy:
go mod tidy
vet:
go vet ./...