import { join } from "node:path"; import type { ProjectCandidate } from "../domain/detection.ts"; import type { ProjectProbe } from "../ports/project-probe.ts"; export type DetectGoProjectInput = { cwd: string; probe: ProjectProbe; }; export async function detectGoProject({ cwd, probe, }: DetectGoProjectInput): Promise { if (await probe.exists(join(cwd, "go.mod"))) { return { language: "go", root: cwd, confidence: "high", reason: "found go.mod", }; } if (await probe.exists(join(cwd, "go.work"))) { return { language: "go", root: cwd, confidence: "high", reason: "found go.work", }; } return undefined; }