From 7a28cc4a56a3a2848aae11e4712afce86049979c Mon Sep 17 00:00:00 2001 From: Honore Vasconcelos Date: Fri, 20 Nov 2015 11:56:14 +0000 Subject: [PATCH 1/2] Correct the use of bin path in windows --- src/goPath.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/goPath.ts b/src/goPath.ts index 6e62192af..5369985f1 100644 --- a/src/goPath.ts +++ b/src/goPath.ts @@ -14,6 +14,7 @@ import { showGoStatus, hideGoStatus } from './goStatus' var binPathCache : { [bin: string]: string;} = {} export function getBinPath(binname) { + binname = correctBinname(binname) if(binPathCache[binname]) return binPathCache[binname]; var workspaces = getGOPATHWorkspaces(); var binpath: string; @@ -27,6 +28,13 @@ export function getBinPath(binname) { return path.join(process.env["GOPATH"], "bin", binname); } +function correctBinname(binname) { + if (process.platform === 'win32') + return binname + ".exe"; + else + return binname +} + function getGOPATHWorkspaces() { var seperator : string; switch(os.platform()) { @@ -75,9 +83,7 @@ export function setupGoPathAndOfferToInstallTools() { } var keys = Object.keys(tools) Promise.all(keys.map(tool => new Promise((resolve, reject) => { - let toolPath = path.join(process.env["GOPATH"], 'bin', tool); - if (process.platform === 'win32') - toolPath = toolPath + ".exe"; + let toolPath = getBinPath(tool); fs.exists(toolPath, exists => { resolve(exists ? null : tools[tool]) }); From 821b545737d672bde4a3ff6b391c4e9a7ae4f199 Mon Sep 17 00:00:00 2001 From: Honore Vasconcelos Date: Fri, 20 Nov 2015 11:58:35 +0000 Subject: [PATCH 2/2] Corrected line matching in error handling for go build tool --- src/goCheck.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/goCheck.ts b/src/goCheck.ts index b2220463c..1eb7d3637 100644 --- a/src/goCheck.ts +++ b/src/goCheck.ts @@ -47,9 +47,9 @@ export function check(filename: string, buildOnSave = true, lintOnSave = true, v var lines = stderr.toString().split('\n'); var ret: ICheckResult[] = []; for(var i = 1; i < lines.length; i++) { - var match = /(.*):(\d+): (.*)/.exec(lines[i]); + var match = /([^:]*):(\d+)(:\d+)?: (.*)/.exec(lines[i]); if(!match) continue; - var [_, file, lineStr, msg] = match; + var [_, file, lineStr, charStr, msg] = match; var line = +lineStr; ret.push({ file: path.resolve(cwd, file), line, msg, severity: "error" }); }