mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-09 23:24:05 -08:00
Add test of Go module versions
Make sure that the Go versions in all `go.mod` files are in sync. Signed-off-by: SuperQ <superq@gmail.com>
This commit is contained in:
parent
b9960d6d8d
commit
bf2b1ac115
9
Makefile
9
Makefile
|
@ -93,9 +93,9 @@ endif
|
||||||
# If we only want to only test go code we have to change the test target
|
# If we only want to only test go code we have to change the test target
|
||||||
# which is called by all.
|
# which is called by all.
|
||||||
ifeq ($(GO_ONLY),1)
|
ifeq ($(GO_ONLY),1)
|
||||||
test: common-test
|
test: common-test check-go-mod-version
|
||||||
else
|
else
|
||||||
test: common-test ui-build-module ui-test ui-lint
|
test: common-test ui-build-module ui-test ui-lint check-go-mod-version
|
||||||
endif
|
endif
|
||||||
|
|
||||||
.PHONY: npm_licenses
|
.PHONY: npm_licenses
|
||||||
|
@ -138,3 +138,8 @@ bench_tsdb: $(PROMU)
|
||||||
cli-documentation:
|
cli-documentation:
|
||||||
$(GO) run ./cmd/prometheus/ --write-documentation > docs/command-line/prometheus.md
|
$(GO) run ./cmd/prometheus/ --write-documentation > docs/command-line/prometheus.md
|
||||||
$(GO) run ./cmd/promtool/ write-documentation > docs/command-line/promtool.md
|
$(GO) run ./cmd/promtool/ write-documentation > docs/command-line/promtool.md
|
||||||
|
|
||||||
|
.PHONY: check-go-mod-version
|
||||||
|
check-go-mod-version:
|
||||||
|
@echo ">> checking go.mod version matching"
|
||||||
|
@./scripts/check-go-mod-version.sh
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
module github.com/prometheus/prometheus/documentation/examples/remote_storage
|
module github.com/prometheus/prometheus/documentation/examples/remote_storage
|
||||||
|
|
||||||
go 1.18
|
go 1.20
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/alecthomas/kingpin/v2 v2.3.2
|
github.com/alecthomas/kingpin/v2 v2.3.2
|
||||||
|
|
12
scripts/check-go-mod-version.sh
Executable file
12
scripts/check-go-mod-version.sh
Executable file
|
@ -0,0 +1,12 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
readarray -t mod_files < <(find . -type f -name go.mod)
|
||||||
|
|
||||||
|
echo "Checking files ${mod_files[@]}"
|
||||||
|
|
||||||
|
matches=$(awk '$1 == "go" {print $2}' "${mod_files[@]}" | sort -u | wc -l)
|
||||||
|
|
||||||
|
if [[ "${matches}" -ne 1 ]]; then
|
||||||
|
echo 'Not all go.mod files have matching go versions'
|
||||||
|
exit 1
|
||||||
|
fi
|
Loading…
Reference in a new issue