@@ -46,25 +46,37 @@ vet: ## Run go vet against code
4646generate : controller-gen # # Generate code
4747 $(CONTROLLER_GEN ) object:headerFile=" hack/boilerplate.go.txt" paths=" ./..."
4848
49- $(GO-LICENSES ) :
50- go install github.com/google/go-licenses@latest
49+ $(GO_LICENSES ) :
50+ @if ! which $@ & > /dev/null; then \
51+ go install github.com/google/go-licenses@latest; \
52+ fi
5153
52- licenses.csv : go.mod # # Track licenses in a CSV file
54+ licenses.csv : go.mod $( GO_LICENSES ) # # Track licenses in a CSV file
5355 @echo " Tracking licenses into file $@ "
5456 @echo " ========================================"
5557 GOOS=linux GOARCH=amd64 $(GO_LICENSES ) csv --include_tests $(BASE_GO_PACKAGE ) /... > $@
5658
57- .PHONY : check-licenses
58- check-licenses : licenses.csv # # Check licenses
59+ # We only check that go.mod is NOT newer than licenses.csv because the CI
60+ # tends to generate slightly different results, so content comparison wouldn't work
61+ licenses-tracked : # # Checks license.csv is up to date
62+ @if [ go.mod -nt licenses.csv ]; then \
63+ echo " License.csv is stale! Please run 'make licenses.csv' and commit" ; exit 1; \
64+ else echo " License.csv OK (up to date)" ; fi
65+
66+ .PHONY : check-licenses-compliance
67+ check-licenses-compliance : licenses.csv # # Check licenses are compliant with our restrictions
5968 @echo " Checking licenses not to be: $( DISALLOWED_LICENSES) "
6069 @echo " ============================================"
6170 GOOS=linux GOARCH=amd64 $(GO_LICENSES ) check --include_tests $(BASE_GO_PACKAGE ) /... \
6271 --disallowed_types $(DISALLOWED_LICENSES )
6372 @echo " --------------------"
6473 @echo " Licenses check: PASS"
6574
75+ .PHONY : check-licenses
76+ check-licenses : licenses-tracked check-licenses-compliance # # Check license tracking & compliance
77+
6678TEST ?= ./pkg/... ./api/... ./cmd/... ./controllers/... ./test/e2e/util/mongotester/...
67- test : generate fmt vet manifests check-licenses # # Run unit tests
79+ test : generate fmt vet manifests # # Run unit tests
6880 go test $(options ) $(TEST ) -coverprofile cover.out
6981
7082manager : generate fmt vet # # Build operator binary
0 commit comments