@@ -108,15 +108,16 @@ vet: ## Run go vet against code.
108
108
go vet ./...
109
109
110
110
.PHONY : test
111
- test : manifests generate lint vet envtest # # Run tests.
111
+ unit- test : manifests generate lint vet envtest # # Run tests.
112
112
KUBEBUILDER_ASSETS=" $( shell $( ENVTEST) use $( ENVTEST_K8S_VERSION) -p path) " go test ./... -coverprofile cover.out
113
113
114
114
.PHONY : lint
115
- lint : # # Uses gofmt to determine if some files do not follow the recommended format .
116
- if [ ` gofmt -l . | wc -l` -ne 0 ]; then \
115
+ lint : golangci-lint # # Run golangci-lint against code .
116
+ @ if [ ` gofmt -l . | wc -l` -ne 0 ]; then \
117
117
echo There are some malformed files, please make sure to run \' make fmt\' ; \
118
118
exit 1; \
119
119
fi
120
+ $(GOLANGCI_LINT ) run -v --timeout 5m0s
120
121
121
122
# #@ Build
122
123
@@ -129,7 +130,7 @@ run: manifests generate fmt vet ## Run a controller from your host.
129
130
go run ./main.go
130
131
131
132
.PHONY : docker-build
132
- docker-build : test # # Build docker image with the manager.
133
+ docker-build : unit- test # # Build docker image with the manager.
133
134
docker build -t ${IMG} .
134
135
135
136
.PHONY : docker-push
@@ -166,6 +167,11 @@ CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
166
167
controller-gen : # # Download controller-gen locally if necessary.
167
168
$(call go-get-tool,$(CONTROLLER_GEN ) ,sigs.k8s.io/controller-tools/cmd/[email protected] )
168
169
170
+ GOLANGCI_LINT = $(shell pwd) /bin/golangci-lint
171
+ .PHONY : golangci-lint
172
+ golangci-lint : # # Download golangci-lint locally if necessary.
173
+ $(call go-get-tool,$(GOLANGCI_LINT ) ,github.com/golangci/golangci-lint/cmd/[email protected] )
174
+
169
175
.PHONY : mockgen
170
176
mockgen : # # Install mockgen locally.
171
177
go install github.com/golang/mock/
[email protected]
0 commit comments