You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
scripts/zx/ensure_go_version.mjs

23 lines
454 B
JavaScript

#!/usr/bin/env zx
$.verbose = false;
try {
const catOutput = await $`cat go.mod`;
const contents = catOutput.stdout;
const lines = contents.split("\n");
let goVersion = "";
for (let line of lines) {
if (line.startsWith("go ")) {
goVersion = line.substring("go ".length);
break
}
}
await $`gvm install go${goVersion}`
console.log(goVersion)
} catch (e) {
await $`exit 0`;
}