mirror of
https://github.com/github/codeql-action.git
synced 2026-01-02 04:30:14 +08:00
Add CLI feature flag to disable Go workaround
This commit is contained in:
@@ -28,6 +28,7 @@ import {
|
||||
getActionsStatus,
|
||||
sendStatusReport,
|
||||
} from "./status-report";
|
||||
import { ToolsFeature, isSupportedToolsFeature } from "./tools-features";
|
||||
import { getTotalCacheSize } from "./trap-caching";
|
||||
import {
|
||||
checkDiskUsage,
|
||||
@@ -315,6 +316,9 @@ async function run() {
|
||||
}
|
||||
|
||||
try {
|
||||
// Query CLI for supported features
|
||||
const versionInfo = await codeql.getVersion();
|
||||
|
||||
// Forward Go flags
|
||||
const goFlags = process.env["GOFLAGS"];
|
||||
if (goFlags) {
|
||||
@@ -327,7 +331,11 @@ async function run() {
|
||||
// https://github.com/github/codeql-team/issues/2411
|
||||
if (
|
||||
config.languages.includes(Language.go) &&
|
||||
process.platform === "linux"
|
||||
process.platform === "linux" &&
|
||||
!isSupportedToolsFeature(
|
||||
versionInfo,
|
||||
ToolsFeature.IndirectTracingSupportsStaticBinaries,
|
||||
)
|
||||
) {
|
||||
try {
|
||||
const goBinaryPath = await safeWhich("go");
|
||||
|
||||
20
src/tools-features.ts
Normal file
20
src/tools-features.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { VersionInfo } from "./codeql";
|
||||
|
||||
export enum ToolsFeature {
|
||||
FeaturesInVersionResult = "featuresInVersionResult",
|
||||
IndirectTracingSupportsStaticBinaries = "indirectTracingSupportsStaticBinaries",
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the given feature is supported by the CLI.
|
||||
*
|
||||
* @param versionInfo Version information, including features, returned by the CLI.
|
||||
* @param feature The feature to check for.
|
||||
* @returns True if the feature is supported or false otherwise.
|
||||
*/
|
||||
export function isSupportedToolsFeature(
|
||||
versionInfo: VersionInfo,
|
||||
feature: ToolsFeature,
|
||||
): boolean {
|
||||
return !!versionInfo.features && versionInfo.features[feature];
|
||||
}
|
||||
Reference in New Issue
Block a user