From 60a00ed8918654ced72172bfd5394e70f462bc9b Mon Sep 17 00:00:00 2001 From: "Hana (Hyang-Ah) Kim" Date: Sat, 15 Aug 2020 08:56:34 -0400 Subject: [PATCH] [release] 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 Reviewed-by: Suzy Mueller (cherry picked from commit 1e4dbe2d650e5ba1fef7ed92d43717cbdb42a88d) Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/252118 TryBot-Result: kokoro --- src/testUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/testUtils.ts b/src/testUtils.ts index a721df9911..99f82fdd17 100644 --- a/src/testUtils.ts +++ b/src/testUtils.ts @@ -486,7 +486,7 @@ export function cancelRunningTests(): Thenable { 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])); }