From 5aeae2db659993fa809641558e972e9dee76db1a Mon Sep 17 00:00:00 2001 From: dc-bytedance Date: Wed, 10 Jun 2026 14:25:15 +0800 Subject: [PATCH] fix: harden riscv64 -race guard and restore Makefile newline The cherry-picked riscv64 commit derived RACE_FLAG from `go env GOARCH` via a grep pipeline, which ignores a GOARCH passed on the make command line (e.g. `make GOARCH=riscv64 unit-test`) since command-line make variables are not visible to $(shell ...). Switch to a make-native filter that honors both, and restore the trailing newline the same commit dropped. --- Makefile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 8f432638c..07cb3d740 100644 --- a/Makefile +++ b/Makefile @@ -8,8 +8,12 @@ DATE := $(shell date +%Y-%m-%d) LDFLAGS := -s -w -X $(MODULE)/internal/build.Version=$(VERSION) -X $(MODULE)/internal/build.Date=$(DATE) PREFIX ?= /usr/local -# -race is not supported on linux/riscv64 before Go 1.26. -RACE_FLAG := $(shell go env GOARCH | grep -qv '^riscv64$$' && echo '-race' || echo '') +# The repository's Go 1.23 CI toolchain does not support -race on riscv64. +# Prefer GOARCH passed to make (for example, `make GOARCH=riscv64 unit-test`) +# over `go env GOARCH`, because command-line make variables are not visible to +# $(shell ...). +TEST_GOARCH := $(or $(GOARCH),$(shell go env GOARCH)) +RACE_FLAG := $(if $(filter riscv64,$(TEST_GOARCH)),,-race) .PHONY: all build vet fmt-check test unit-test integration-test examples-build install uninstall clean fetch_meta gitleaks @@ -70,4 +74,4 @@ clean: gitleaks: @bash scripts/check-doc-tokens.sh @command -v gitleaks >/dev/null 2>&1 || { echo "gitleaks not found. Install: brew install gitleaks"; exit 1; } - gitleaks detect --redact -v --exit-code=2 \ No newline at end of file + gitleaks detect --redact -v --exit-code=2