diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 61b3cd553ab..d24e5a4276a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,7 +47,7 @@ jobs: - name: Generate run: make generate - name: Run linters - run: make license-check lint vanity-import-check + run: make toolchain-check license-check lint vanity-import-check - name: Build run: make build - name: Check clean repository diff --git a/Makefile b/Makefile index 7538aa25320..c119eb21edb 100644 --- a/Makefile +++ b/Makefile @@ -18,8 +18,8 @@ TIMEOUT = 60 .DEFAULT_GOAL := precommit .PHONY: precommit ci -precommit: generate license-check misspell go-mod-tidy golangci-lint-fix test-default -ci: generate license-check lint vanity-import-check build test-default check-clean-work-tree test-coverage +precommit: generate toolchain-check license-check misspell go-mod-tidy golangci-lint-fix test-default +ci: generate toolchain-check license-check lint vanity-import-check build test-default check-clean-work-tree test-coverage # Tools @@ -189,6 +189,16 @@ vanity-import-check: | $(PORTO) .PHONY: lint lint: go-mod-tidy golangci-lint misspell govulncheck +.PHONY: toolchain-check +toolchain-check: + @toolchainRes=$$(for f in $(ALL_GO_MOD_DIRS); do \ + awk '/^toolchain/ { found=1; next } END { if (found) print FILENAME }' $$f/go.mod; \ + done); \ + if [ -n "$${toolchainRes}" ]; then \ + echo "toolchain checking failed:"; echo "$${toolchainRes}"; \ + exit 1; \ + fi + .PHONY: license-check license-check: @licRes=$$(for f in $$(find . -type f \( -iname '*.go' -o -iname '*.sh' \) ! -path './vendor/*' ! -path './exporters/otlp/internal/opentelemetry-proto/*') ; do \