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

Commit

Permalink
Support build tags with go vet (#1625)
Browse files Browse the repository at this point in the history
Adds build tags to the go vet command if they are present in the
workspace.
  • Loading branch information
novak authored and ramya-rao-a committed Apr 30, 2018
1 parent 707e520 commit 98eff26
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/goVet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,15 @@ export function goVet(fileUri: vscode.Uri, goConfig: vscode.WorkspaceConfigurati
const vetFlags = goConfig['vetFlags'] || [];
const vetEnv = Object.assign({}, getToolsEnvVars());
const vetPromise = getGoVersion().then((version: SemVersion) => {
let vetArgs = ['vet', ...vetFlags, './...'];
const tagsArg = [];
if (goConfig['buildTags'] && vetFlags.indexOf('-tags') === -1) {
tagsArg.push('-tags');
tagsArg.push(goConfig['buildTags']);
}

let vetArgs = ['vet', ...vetFlags, ...tagsArg, './...'];
if (version && version.major === 1 && version.minor <= 9 && vetFlags.length) {
vetArgs = ['tool', 'vet', ...vetFlags, '.'];
vetArgs = ['tool', 'vet', ...vetFlags, ...tagsArg, '.'];
}

running = true;
Expand Down

0 comments on commit 98eff26

Please sign in to comment.