From b2a914a1f6f5bd23aba655b414b882cf62ddd1a9 Mon Sep 17 00:00:00 2001 From: PrometheusBot Date: Tue, 1 Oct 2024 11:41:15 +0200 Subject: [PATCH] Synchronize common files from prometheus/prometheus (#83) * Update common Prometheus files Signed-off-by: prombot * Added format command. Signed-off-by: bwplotka --------- Signed-off-by: prombot Signed-off-by: bwplotka Co-authored-by: bwplotka --- Makefile | 19 ++++++++++++++++++- Makefile.common | 6 ++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e8dd516..7501e54 100644 --- a/Makefile +++ b/Makefile @@ -7,4 +7,21 @@ DOCKER_REPO ?= prometheuscommunity include Makefile.common -DOCKER_IMAGE_NAME ?= avalanche +DOCKER_IMAGE_NAME ?= avalanche + +GOIMPORTS = goimports +$(GOIMPORTS): + @go install golang.org/x/tools/cmd/goimports@latest + +GOFUMPT = gofumpt +$(GOFUMPT): + @go install mvdan.cc/gofumpt@latest + +GO_FILES = $(shell find . -path ./vendor -prune -o -name '*.go' -print) + +.PHONY: format +format: $(GOFUMPT) $(GOIMPORTS) + @echo ">> formating imports)" + @$(GOIMPORTS) -local github.com/prometheus-community/avalanche -w $(GO_FILES) + @echo ">> gofumpt-ing the code; golangci-lint requires this" + @$(GOFUMPT) -extra -w $(GO_FILES) diff --git a/Makefile.common b/Makefile.common index 34d65bb..cbb5d86 100644 --- a/Makefile.common +++ b/Makefile.common @@ -275,3 +275,9 @@ $(1)_precheck: exit 1; \ fi endef + +govulncheck: install-govulncheck + govulncheck ./... + +install-govulncheck: + command -v govulncheck > /dev/null || go install golang.org/x/vuln/cmd/govulncheck@latest