18
18
# Makefile with some common workflow for dev, build and test
19
19
#
20
20
export GOPROXY?=https ://proxy.golang.org/
21
- CONTROLLER_GEN_BIN_PATH := $(shell which controller-gen)
22
21
23
22
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
24
23
ifeq (,$(shell go env GOBIN) )
@@ -46,7 +45,7 @@ build: ## Build the project locally
46
45
.PHONY : install
47
46
install : # # Build and install the binary with the current source code. Use it to test your changes locally.
48
47
make build
49
- cp ./bin/kubebuilder $(shell go env GOPATH) /bin /kubebuilder
48
+ cp ./bin/kubebuilder $(GOBIN ) /kubebuilder
50
49
51
50
# #@ Development
52
51
@@ -60,22 +59,19 @@ generate-testdata: ## Update/generate the testdata in $GOPATH/src/sigs.k8s.io/ku
60
59
./generate_testdata.sh
61
60
62
61
.PHONY : lint
63
- lint : golangci-lint # # Run golangci lint checks
64
- @ $(GOLANGCI_LINT ) run
62
+ lint : golangci-lint # # Run golangci- lint linter
63
+ $(GOLANGCI_LINT ) run
65
64
66
- lint-fix : golangci-lint # # Run golangci lint to automatically perform fixes
67
- @$(GOLANGCI_LINT ) run --fix
65
+ .PHONY : lint-fix
66
+ lint-fix : golangci-lint # # Run golangci-lint linter and perform fixes
67
+ $(GOLANGCI_LINT ) run --fix
68
68
69
+ GOLANGCI_LINT = $(shell pwd) /bin/golangci-lint
69
70
golangci-lint :
70
- ifeq (, $(shell which golangci-lint) )
71
- @{ \
71
+ @[ -f $( GOLANGCI_LINT) ] || { \
72
72
set -e ; \
73
- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v1.29.0 ;\
73
+ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell dirname $( GOLANGCI_LINT ) ) v1.29.0 ; \
74
74
}
75
- GOLANGCI_LINT =$(shell go env GOPATH) /bin/golangci-lint
76
- else
77
- GOLANGCI_LINT =$(shell which golangci-lint)
78
- endif
79
75
80
76
# #@ Tests
81
77
0 commit comments