chore: support automatically changing go version
parent
8333830573
commit
013575e551
@ -0,0 +1,22 @@
|
|||||||
|
#!/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`;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue