-
Notifications
You must be signed in to change notification settings - Fork 646
Fix gopath bin location search and error in error line parsing in windows #46
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ import { showGoStatus, hideGoStatus } from './goStatus' | |
var binPathCache : { [bin: string]: string;} = {} | ||
|
||
export function getBinPath(binname) { | ||
binname = correctBinname(binname) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correcting should be done after checking cache. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed. |
||
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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What would you suggest instead? Perhaps just return Edit: Actually that won't work by itself since we use the returned path in calls to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Leaving it on |
||
} | ||
|
||
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<string>((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]) | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
binPathCache
is not used?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed - looks like we've never been writing to the cache. We should either do that or remove the cache code for now pending figuring out how much of a perf hit this codepath is.