Skip to content
This repository was archived by the owner on Sep 11, 2025. It is now read-only.

Commit 7d849a9

Browse files
fix: fully install go sdk in dev mode (#837)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent abc8dcd commit 7d849a9

File tree

3 files changed

+30
-11
lines changed

3 files changed

+30
-11
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
# Change Log
44

5+
## 2025-05-06 - CLI 0.17.4
6+
7+
- fix: fully install go sdk in dev mode [#811](https://github.com/hypermodeinc/modus/pull/811)
8+
59
## 2025-04-29 - Go SDK 0.17.4
610

711
- fix: Relax postgresql connString regex to allow host to be templated [#830](https://github.com/hypermodeinc/modus/pull/830)

cli/src/commands/dev/index.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { getAppInfo } from "../../util/appinfo.js";
2525
import { isOnline, withSpinner } from "../../util/index.js";
2626
import { readHypermodeSettings } from "../../util/hypermode.js";
2727
import BuildCommand from "../build/index.js";
28+
import SDKInstallCommand from "../sdk/install/index.js";
2829
import { BaseCommand } from "../../baseCommand.js";
2930

3031
const MANIFEST_FILE = "modus.json";
@@ -85,16 +86,7 @@ export default class DevCommand extends BaseCommand {
8586
}
8687

8788
if (!(await vi.sdkVersionIsInstalled(sdk, sdkVersion))) {
88-
const sdkText = `Modus ${sdk} SDK ${sdkVersion}`;
89-
await withSpinner(chalk.dim("Downloading and installing " + sdkText), async (spinner) => {
90-
try {
91-
await installer.installSDK(sdk, sdkVersion);
92-
} catch (e) {
93-
spinner.fail(chalk.red(`Failed to download ${sdkText}`));
94-
throw e;
95-
}
96-
spinner.succeed(chalk.dim(`Installed ${sdkText}`));
97-
});
89+
await SDKInstallCommand.run([sdk, sdkVersion, "--no-logo"]);
9890
}
9991

10092
let runtimeVersion = flags.runtime;

cli/src/util/versioninfo.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
* SPDX-License-Identifier: Apache-2.0
88
*/
99

10+
import chalk from "chalk";
1011
import semver from "semver";
12+
import os from "node:os";
1113
import path from "node:path";
1214
import * as http from "./http.js";
1315
import * as fs from "./fs.js";
@@ -179,7 +181,28 @@ export async function runtimeReleaseExists(version: string): Promise<boolean> {
179181
}
180182

181183
export async function sdkVersionIsInstalled(sdk: globals.SDK, version: string): Promise<boolean> {
182-
return await fs.exists(getSdkPath(sdk, version));
184+
// normal check for SDK path
185+
const sdkPath = getSdkPath(sdk, version);
186+
const installed = await fs.exists(sdkPath);
187+
if (!installed) {
188+
return false;
189+
}
190+
191+
// extra check for Go build tool, due to prior issue with it not being installed in all cases
192+
if (sdk === globals.SDK.Go) {
193+
const ext = os.platform() === "win32" ? ".exe" : "";
194+
const buildTool = path.join(sdkPath, "modus-go-build" + ext);
195+
if (await fs.exists(buildTool)) {
196+
return true;
197+
}
198+
199+
// SDK installed, but build tool not found, so delete and return false so it can be reinstalled
200+
console.log(chalk.yellow(`ⓘ Detected incomplete installation of Modus Go SDK ${version}. Reinstalling...`));
201+
await fs.rm(sdkPath, { recursive: true, force: true });
202+
return false;
203+
}
204+
205+
return installed;
183206
}
184207

185208
export async function runtimeVersionIsInstalled(version: string): Promise<boolean> {

0 commit comments

Comments
 (0)