Skip to content

Commit 4611ff9

Browse files
committed
Cross-check Go binary in analyze Action
1 parent 2bd75f5 commit 4611ff9

3 files changed

Lines changed: 24 additions & 1 deletion

File tree

lib/analyze-action.js

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/analyze-action.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/analyze-action.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import path from "path";
33
import { performance } from "perf_hooks";
44

55
import * as core from "@actions/core";
6+
import { safeWhich } from "@chrisgavin/safe-which";
67

78
import * as actionsUtil from "./actions-util";
89
import {
@@ -231,6 +232,19 @@ async function run() {
231232
logger,
232233
);
233234

235+
// Check that the Go wrapper script still exists, if set
236+
const goWrapperPath = process.env[EnvVar.GO_BINARY_LOCATION];
237+
238+
if (goWrapperPath !== undefined) {
239+
const goBinaryPath = await safeWhich("go");
240+
241+
if (goWrapperPath !== goBinaryPath) {
242+
core.warning(
243+
"Unexpected result for `which go`: please ensure that the correct version of Go is installed before the `codeql-action/init` Action is used.",
244+
);
245+
}
246+
}
247+
234248
await runAutobuildIfLegacyGoWorkflow(config, logger);
235249

236250
dbCreationTimings = await runFinalize(

0 commit comments

Comments
 (0)