feat: add Go migration compatibility foundation

This commit is contained in:
2026-08-13 10:35:52 +08:00
parent 7de3300034
commit 716a8031b1
27 changed files with 2582 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
#!/usr/bin/env node
import { spawn } from "node:child_process";
import { fileURLToPath } from "node:url";
const [, , command, ...args] = process.argv;
if (!command) {
console.error("Usage: node scripts/run-go-command.mjs <go-command> [args...]");
process.exit(2);
}
const backendDirectory = fileURLToPath(new URL("../backend/", import.meta.url));
const child = spawn("go", [command, ...args], {
cwd: backendDirectory,
env: {
...process.env,
CGO_ENABLED: process.env.CGO_ENABLED || "0",
},
stdio: "inherit",
});
child.on("error", (error) => {
console.error(`[go:${command}] ${error.message}`);
process.exit(1);
});
child.on("exit", (code, signal) => {
if (signal) {
console.error(`[go:${command}] terminated by ${signal}`);
process.exit(1);
}
process.exit(code ?? 1);
});