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

Commit d31636a

Browse files
committed
Support resolving variables in both -config and --config flags of linters
1 parent 5b6fa9f commit d31636a

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Go-latest.vsix

48 Bytes
Binary file not shown.

src/goLint.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,19 @@ export function goLint(fileUri: vscode.Uri, goConfig: vscode.WorkspaceConfigurat
5757
const lintFlags: string[] = goConfig['lintFlags'] || [];
5858
const lintEnv = Object.assign({}, getToolsEnvVars());
5959
const args = [];
60-
const configFlag = '--config=';
6160

6261
lintFlags.forEach(flag => {
6362
// --json is not a valid flag for golint and in gometalinter, it is used to print output in json which we dont want
6463
if (flag === '--json') {
6564
return;
6665
}
67-
if (flag.startsWith(configFlag)) {
68-
let configFilePath = flag.substr(configFlag.length);
66+
if (flag.startsWith('--config=') || flag.startsWith('-config=')) {
67+
let configFilePath = flag.substr(flag.indexOf('=') + 1).trim();
68+
if (!configFilePath) {
69+
return;
70+
}
6971
configFilePath = resolvePath(configFilePath);
70-
args.push(`${configFlag}${configFilePath}`);
72+
args.push(`${flag.substr(0, flag.indexOf('=') + 1)}${configFilePath}`);
7173
return;
7274
}
7375
args.push(flag);

0 commit comments

Comments
 (0)