Skip to content

Commit d1526fa

Browse files
logica0419h9jiang
authored andcommitted
extension/src/goLint: adding --path-mode=abs flag for golangci-lint v2
This change sets path mode to abs (supported from golangci-lint v2.1) when running golangci-lint v2. When `run.relative-path-mode` is set to `cfg` (which is the default), the file path in the linter output is relative to the config file, while vscode-go treats it as relative to the linted file. That makes the file path invalid, which prevents diagnostic errors from showing. The absolute output path is the efficient way to fix this problem. Fixes #3750 Change-Id: I77bc8a54062bad094128a14d764db94198379ee9 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/664877 Reviewed-by: Hongxiang Jiang <[email protected]> Reviewed-by: Madeline Kalil <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> kokoro-CI: kokoro <[email protected]>
1 parent 5e6ba19 commit d1526fa

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

extension/src/goLint.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,10 @@ export async function goLint(
165165
// Explicit override in case .golangci.yml calls for a format we don't understand
166166
args.push('--output.text.colors=true');
167167
}
168+
if (args.indexOf('--path-mode=abs') === -1) {
169+
// print file name as absolute path
170+
args.push('--path-mode=abs');
171+
}
168172
break;
169173
}
170174
}

0 commit comments

Comments
 (0)