mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
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`.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user