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

Support build tags with go vet #1625

Merged
merged 1 commit into from
Apr 30, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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