Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Commit

Permalink
Use go vet instead of go tool vet when no flags #1215
Browse files Browse the repository at this point in the history
  • Loading branch information
ramya-rao-a committed Nov 9, 2017
1 parent 3c85b48 commit 8d7608d
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/goCheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,8 @@ export function check(fileUri: vscode.Uri, goConfig: vscode.WorkspaceConfigurati

if (!!goConfig['vetOnSave'] && goConfig['vetOnSave'] !== 'off') {
let vetFlags = goConfig['vetFlags'] || [];
let vetArgs = ['tool', 'vet', ...vetFlags, '.'];
let vetWorkDir = cwd;

if (goConfig['vetOnSave'] === 'workspace' && currentWorkspace) {
vetWorkDir = currentWorkspace;
}
let vetArgs = vetFlags.length ? ['tool', 'vet', ...vetFlags, '.'] : ['vet', './...'];
let vetWorkDir = (goConfig['vetOnSave'] === 'workspace' && currentWorkspace) ? currentWorkspace : cwd;

runningToolsPromises.push(runTool(
vetArgs,
Expand All @@ -170,11 +166,12 @@ export function check(fileUri: vscode.Uri, goConfig: vscode.WorkspaceConfigurati
});
}

return Promise.all(runningToolsPromises).then(function(resultSets){
return Promise.all(runningToolsPromises).then(function (resultSets) {
let results: ICheckResult[] = [].concat.apply([], resultSets);
// Filter duplicates
return results.filter((results, index, self) =>
self.findIndex((t) => {
return t.file === results.file && t.line === results.line && t.msg === results.msg && t.severity === results.severity; }) === index);
return t.file === results.file && t.line === results.line && t.msg === results.msg && t.severity === results.severity;
}) === index);
});
}

0 comments on commit 8d7608d

Please sign in to comment.