diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -195,6 +195,7 @@ help: @echo " - swagger-validate check if the swagger spec is valid" @echo " - golangci-lint run golangci-lint linter" @echo " - vet examines Go source code and reports suspicious constructs" + @echo " - tidy run go mod tidy" @echo " - test[\#TestSpecificName] run unit test" @echo " - test-sqlite[\#TestSpecificName] run integration test for sqlite" @echo " - pr#<index> build and start gitea from a PR with integration test data loaded" @@ -369,16 +370,20 @@ unit-test-coverage: @echo "Running unit-test-coverage $(GOTESTFLAGS) -tags '$(TEST_TAGS)'..." @$(GO) test $(GOTESTFLAGS) -timeout=20m -tags='$(TEST_TAGS)' -cover -coverprofile coverage.out $(GO_PACKAGES) && echo "\n==>\033[32m Ok\033[m\n" || exit 1 +.PHONY: tidy +tidy: + $(eval MIN_GO_VERSION := $(shell grep -Eo '^go\s+[0-9]+\.[0-9.]+' go.mod | cut -d' ' -f2)) + $(GO) mod tidy -compat=$(MIN_GO_VERSION) + .PHONY: vendor -vendor: - $(GO) mod tidy && $(GO) mod vendor +vendor: tidy + $(GO) mod vendor .PHONY: gomod-check -gomod-check: - @$(GO) mod tidy +gomod-check: tidy @diff=$$(git diff go.sum); \ if [ -n "$$diff" ]; then \ - echo "Please run '$(GO) mod tidy' and commit the result:"; \ + echo "Please run 'make tidy' and commit the result:"; \ echo "$${diff}"; \ exit 1; \ fi |