src/testUtils.ts: fix parsing of the compiler error file expansion Build error output format can be different from the test output format. Adjust the regex change in expandFilePathInOutput so it can capture build errors that contain column numbers as well while capturing the file path from test outputs such as ``` TestB: b_test.go:6: test failed ``` The above line was incorrectly expanded in pre v0.16.0 pre v0.16.0: /^\s*(.+.go):(\d+):/ v0.16.0, v0.16.1: /\s+(\S+.go):(\d+):\s+/ this CL: /\s*(\S+\.go):(\d+):/ Fixes golang/vscode-go#522 Change-Id: Ifa8f07d3bb7c5aaa61d40dd29d9fae77d8ad0cbe Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/248737 Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com> Reviewed-by: Suzy Mueller <suzmue@golang.org>
diff --git a/src/testUtils.ts b/src/testUtils.ts index 07d9e3d..7c7df88 100644 --- a/src/testUtils.ts +++ b/src/testUtils.ts
@@ -494,7 +494,7 @@ function expandFilePathInOutput(output: string, cwd: string): string { const lines = output.split('\n'); for (let i = 0; i < lines.length; i++) { - const matches = lines[i].match(/\s+(\S+.go):(\d+):\s+/); + const matches = lines[i].match(/\s*(\S+\.go):(\d+):/); if (matches && matches[1] && !path.isAbsolute(matches[1])) { lines[i] = lines[i].replace(matches[1], path.join(cwd, matches[1])); }