From abdfadf8cbe5267a3a8d3c15dc1f44b12becc74d Mon Sep 17 00:00:00 2001 From: Mathias Fredriksson Date: Tue, 10 Mar 2026 12:07:44 +0200 Subject: [PATCH] build(Makefile): fix lint/go recipe by using bash subshell (#22874) The `lint/go` recipe used `$(shell)` inside a recipe to extract the golangci-lint version. When `MAKE_TIMED=1` (set by pre-commit/pre-push), make expands `.SHELLFLAGS = $@ -ceu` for `$(shell)` calls, passing the target name as the first argument to `timed-shell.sh`. Since the target name doesn't start with `-`, the timing code path runs and its banner output contaminates the captured value, causing intermittent failures: ``` bash: line 3: lint/go: No such file or directory ``` Replace with bash command substitution (`$$()`), which is the correct approach under `.ONESHELL` and avoids the `SHELL`/`.SHELLFLAGS` interaction entirely. Also replaces deprecated `egrep` with `grep -oE`. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index dcf0eb801b..2421a6ddf7 100644 --- a/Makefile +++ b/Makefile @@ -636,7 +636,7 @@ lint/ts: site/node_modules/.installed lint/go: ./scripts/check_enterprise_imports.sh ./scripts/check_codersdk_imports.sh - linter_ver=$(shell egrep -o 'GOLANGCI_LINT_VERSION=\S+' dogfood/coder/Dockerfile | cut -d '=' -f 2) + linter_ver=$$(grep -oE 'GOLANGCI_LINT_VERSION=\S+' dogfood/coder/Dockerfile | cut -d '=' -f 2) go run github.com/golangci/golangci-lint/cmd/golangci-lint@v$$linter_ver run go tool github.com/coder/paralleltestctx/cmd/paralleltestctx -custom-funcs="testutil.Context" ./... .PHONY: lint/go