@@ -33,7 +33,7 @@ CC_PKGS = $(shell go list ./pkg/cc/...)
3333CC_PKGS += $(shell go list ./cmd/cc/...)
3434
3535.PHONY : all
36- all : format generate build test
36+ all : format generate build test test-e2e
3737
3838.PHONY : clean
3939clean :
@@ -85,19 +85,25 @@ update-go-deps:
8585# #############
8686
8787.PHONY : format
88- format : go-fmt jsonnet-fmt check-license shellcheck
88+ format : go-fmt go-vet go-lint go-sec check-license
8989
9090.PHONY : go-fmt
9191go-fmt :
92- gofmt -s -w .
92+ @echo ' Formatting go code...'
93+ @gofmt -s -w .
94+ @echo ' Not formatiing issues found in go codebase!'
95+
9396
9497.PHONY : check-license
9598check-license :
9699 ./hack/check_license.sh
97100
98- .PHONY : lint
99- lint : golangci-lint
100- $(GOLANGCI_LINT ) run
101+
102+ .PHONY : go-lint
103+ go-lint : golangci-lint
104+ @echo ' Linting go code...'
105+ $(GOLANGCI_LINT ) run -v --timeout 5m
106+ @echo ' Not linting issues found in go codebase!'
101107
102108.PHONY : lint-fix
103109lint-fix : golangci-lint
@@ -110,6 +116,18 @@ golangci-lint:
110116 curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell dirname $(GOLANGCI_LINT ) ) v1.41.1 ; \
111117 }
112118
119+ GOSEC = $(shell pwd) /bin/gosec
120+ go-sec : # # Inspects source code for security problems
121+ @if ! command -v gosec > /dev/null 2>&1 ; then $(call go-get-tool,$(GOSEC ) ,github.com/securego/gosec/v2/cmd/gosec) ; fi
122+ @echo ' Checking source code for security problems...'
123+ $(GOSEC ) ./pkg/...
124+ @echo ' No security problems found in go codebase!'
125+
126+ go-vet : # # Identifying subtle source code issues
127+ @echo ' Vetting go code...'
128+ @go vet $(shell pwd) /pkg/api/...
129+ @echo ' Not issues found in go codebase!'
130+
113131
114132# ##########
115133# Testing #
@@ -121,23 +139,21 @@ ENVTEST_ASSETS_DIR=$(shell pwd)/testbin
121139test : test-api test-cc
122140
123141.PHONY : test-api
124- test-api : source-env
125- source $( shell pwd) /.env.sample ; go test -race $(TEST_RUN_ARGS ) -short $(API_PKGS ) -count=1 -v
142+ test-api :
143+ go test -race $(TEST_RUN_ARGS ) -short $(API_PKGS ) -count=1 -v
126144
127145.PHONY : test-cc
128- test-cc : source-env
146+ test-cc :
129147 mkdir -p ${ENVTEST_ASSETS_DIR}
130148 test -f ${ENVTEST_ASSETS_DIR} /setup-envtest.sh || curl -sSLo ${ENVTEST_ASSETS_DIR} /setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/v0.7.2/hack/setup-envtest.sh
131149 source ${ENVTEST_ASSETS_DIR} /setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR ) ; setup_envtest_env $(ENVTEST_ASSETS_DIR ) ; go test -race $(TEST_RUN_ARGS ) -short $(CC_PKGS ) -count=1 -v
132150
133151.PHONY : test-e2e
134- test-e2e : source-env
152+ test-e2e :
135153 $(shell pwd) /local/setup.sh
136- @. local/.env.local && go test github.com/adobe/cluster-registry/test/e2e
154+ @. local/.env.local && go test -race github.com/adobe/cluster-registry/test/e2e -count=1 -v
137155 $(shell pwd) /local/cleanup.sh
138156
139- source-env :
140- source $(shell pwd) /.env.sample
141157
142158
143159# ##############
@@ -163,15 +179,15 @@ generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and
163179
164180# go-get-tool will 'go get' any package $2 and install it to $1.
165181define go-get-tool
166- @[ -f $(1 ) ] || { \
167- set -e ; \
168- TMP_DIR=$$(mktemp -d ) ; \
169- cd $$TMP_DIR ; \
170- go mod init tmp ; \
171- echo "Downloading $(2 ) " ; \
172- GOBIN=$(shell pwd) /bin go get $(2 ) ; \
173- rm -rf $$TMP_DIR ; \
174- }
182+ @[ -f $(1 ) ] || { \
183+ set -e; \
184+ TMP_DIR=$$(mktemp -d ) ; \
185+ cd $$TMP_DIR; \
186+ go mod init tmp; \
187+ echo "Downloading $(2 ) "; \
188+ GOBIN=$(shell pwd) /bin go get $(2 ) ; \
189+ rm -rf $$TMP_DIR; \
190+ }
175191endef
176192
177193# -------------
0 commit comments