diff --git a/Makefile b/Makefile index 6a19d057f53..100ed421bee 100644 --- a/Makefile +++ b/Makefile @@ -67,6 +67,7 @@ REVIEWDOG_VERSION := $(eval REVIEWDOG_VERSION := $(shell cat versions/RE TELEPRESENCE_VERSION := $(eval TELEPRESENCE_VERSION := $(shell cat versions/TELEPRESENCE_VERSION))$(TELEPRESENCE_VERSION) VALDCLI_VERSION := $(eval VALDCLI_VERSION := $(shell cat versions/VALDCLI_VERSION))$(VALDCLI_VERSION) YQ_VERSION := $(eval YQ_VERSION := $(shell cat versions/YQ_VERSION))$(YQ_VERSION) +BUF_VERSION := $(eval BUF_VERSION := $(shell cat versions/BUF_VERSION))$(BUF_VERSION) OTEL_OPERATOR_RELEASE_NAME ?= opentelemetry-operator PROMETHEUS_RELEASE_NAME ?= prometheus @@ -396,7 +397,8 @@ format: \ format/go \ format/json \ format/md \ - format/yaml + format/yaml \ + format/proto .PHONY: format/go ## run golines, gofumpt, goimports for all go files @@ -448,6 +450,11 @@ format/json: \ "charts/**/*.json" \ "hack/**/*.json" +.PHONY: format/proto +format/proto: \ + buf/install \ + buf format -w + .PHONY: deps ## resolve dependencies deps: \ diff --git a/Makefile.d/tools.mk b/Makefile.d/tools.mk index 95e59b58f54..08415f9714f 100644 --- a/Makefile.d/tools.mk +++ b/Makefile.d/tools.mk @@ -83,3 +83,12 @@ textlint/install: textlint/ci/install: npm init -y npm install --save-dev textlint textlint-rule-en-spell textlint-rule-prh textlint-rule-write-good + +.PHONY: buf/install +buf/install: $(BINDIR)/buf + +$(BINDIR)/buf: + curl -sSL \ + "https://github.com/bufbuild/buf/releases/download/v$(BUF_VERSION)/buf-$(uname -s)-$(uname -m)" \ + -o "${BINDIR}/buf" && \ + chmod +x "${BINDIR}/buf" diff --git a/versions/BUF_VERSION b/versions/BUF_VERSION new file mode 100644 index 00000000000..cc904638af8 --- /dev/null +++ b/versions/BUF_VERSION @@ -0,0 +1 @@ +v1.2.2