|
|
|
@ -4,8 +4,8 @@ $.verbose = false;
|
|
|
|
|
|
|
|
|
|
|
|
async function getGoVersion() {
|
|
|
|
async function getGoVersion() {
|
|
|
|
const goVersionProcess = await $`go version`;
|
|
|
|
const goVersionProcess = await $`go version`;
|
|
|
|
const re = /go version go(.*) /
|
|
|
|
const re = /go version go(.*) /;
|
|
|
|
return re.exec(goVersionProcess.stdout)[1]
|
|
|
|
return re.exec(goVersionProcess.stdout)[1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
@ -19,15 +19,15 @@ try {
|
|
|
|
let re = /version:\sv(.*)/
|
|
|
|
let re = /version:\sv(.*)/
|
|
|
|
const targetVersion = re.exec(contents)[1]
|
|
|
|
const targetVersion = re.exec(contents)[1]
|
|
|
|
|
|
|
|
|
|
|
|
let currentVersion = await $`golangci-lint --version`
|
|
|
|
let currentVersion = await $`golangci-lint --version`;
|
|
|
|
re = /golangci-lint has version (.*) built.*/
|
|
|
|
re = /golangci-lint has version (.*) built.*/;
|
|
|
|
currentVersion = re.exec(currentVersion.stdout)[1]
|
|
|
|
currentVersion = re.exec(currentVersion.stdout)[1];
|
|
|
|
|
|
|
|
|
|
|
|
let goVersion = await getGoVersion()
|
|
|
|
let goVersion = await getGoVersion()
|
|
|
|
goVersion = goVersion.substring(0, 4); // strip off the patch version
|
|
|
|
goVersion = goVersion.substring(0, 4); // strip off the patch version
|
|
|
|
if (currentVersion !== targetVersion) {
|
|
|
|
if (currentVersion !== targetVersion) {
|
|
|
|
await $`curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /Users/chatton/.gvm/pkgsets/go${goVersion}/global/bin v${targetVersion}`
|
|
|
|
await $`curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /Users/chatton/.gvm/pkgsets/go${goVersion}/global/bin v${targetVersion}`
|
|
|
|
console.log("updated to version " + targetVersion);
|
|
|
|
console.log("updated to golangci-lint version " + targetVersion);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
} catch (e) {
|
|
|
|
|