From eaaf16bf237eea162e9e4e7b9588ac2ab3b7f513 Mon Sep 17 00:00:00 2001 From: Anton Nikiforov Date: Tue, 28 May 2024 12:14:13 +0300 Subject: [PATCH] [#1147] Makefile: Fix `gopls-run` target Signed-off-by: Anton Nikiforov --- Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 710c12703..c93d06aa8 100755 --- a/Makefile +++ b/Makefile @@ -44,9 +44,12 @@ PROTOGEN_FROSTFS_DIR ?= $(PROTOBUF_DIR)/protogen-$(PROTOGEN_FROSTFS_VERSION) STATICCHECK_DIR ?= $(abspath $(BIN))/staticcheck STATICCHECK_VERSION_DIR ?= $(STATICCHECK_DIR)/$(STATICCHECK_VERSION) +SOURCES = $(shell find . -type f -name "*.go" -print) + GOPLS_VERSION ?= v0.15.1 GOPLS_DIR ?= $(abspath $(BIN))/gopls GOPLS_VERSION_DIR ?= $(GOPLS_DIR)/$(GOPLS_VERSION) +GOPLS_TEMP_FILE := $(shell mktemp) FROSTFS_CONTRACTS_PATH=$(abspath ./../frostfs-contract) LOCODE_DB_PATH=$(abspath ./.cache/locode_db) @@ -220,9 +223,12 @@ gopls-run: @if [ ! -d "$(GOPLS_VERSION_DIR)" ]; then \ make gopls-install; \ fi - @if [[ $$(find . -type f -name "*.go" -print | xargs $(GOPLS_VERSION_DIR)/gopls check | tee /dev/tty | wc -l) -ne 0 ]]; then \ + $(GOPLS_VERSION_DIR)/gopls check $(SOURCES) 2>&1 >$(GOPLS_TEMP_FILE) + @if [[ $$(wc -l < $(GOPLS_TEMP_FILE)) -ne 0 ]]; then \ + cat $(GOPLS_TEMP_FILE); \ exit 1; \ fi + rm $(GOPLS_TEMP_FILE) # Run linters in Docker docker/lint: