From 96780b07b62c358c5b7e8cd30973a846fc637698 Mon Sep 17 00:00:00 2001 From: Vishal Rana Date: Thu, 3 Dec 2026 08:23:08 -0800 Subject: [PATCH] ci: analyze dead code with the pinned DuckDB build tag deadcode passes its own empty -tags to go list, which overrides the duckdb_use_static_lib tag that scripts/with-duckdb.sh exports in GOFLAGS. The check therefore analyzed a build no other job compiles, and on Linux that build needs a single-threaded link against the DuckDB static archives. When the shared Go cache lacked that link the check took 5 to 11 minutes instead of seconds. Co-Authored-By: Claude Fable 5.2 --- scripts/go-deadcode.mjs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/go-deadcode.mjs b/scripts/go-deadcode.mjs index 0b8b4414c..ff85eb837 100644 --- a/scripts/go-deadcode.mjs +++ b/scripts/go-deadcode.mjs @@ -15,7 +15,10 @@ if (listed.error || listed.status !== 0) { const roots = [...new Set(listed.stdout.split(/\r?\n/).map(line => line.trim()).filter(Boolean))].sort(); if (!roots.length) { console.error("No production main packages found"); process.exit(1); } console.log("Production deadcode roots:\n" + roots.join("\n")); -const result = run(["go", "tool", "deadcode", "-test=false", "-json", ...roots]); +// deadcode always passes its own -tags to `go list`, which overrides the +// GOFLAGS tags the wrapper exports. Without the tag here it analyzes a build +// nothing else compiles, and Linux spends minutes linking it uncached. +const result = run(["go", "tool", "deadcode", "-tags=duckdb_use_static_lib", "-test=false", "-json", ...roots]); if (result.error) { console.error(result.error.message); process.exit(1); } if (result.stderr) process.stderr.write(result.stderr); if (result.status !== 0) { if(result.stdout) process.stdout.write(result.stdout); process.exit(result.status ?? 1); }