From bf64c0899f076b8a62071ffae22fb9b35af667c0 Mon Sep 17 00:00:00 2001 From: Thorsten Ball Date: Tue, 10 Sep 2024 10:22:12 -0400 Subject: [PATCH] go: Fix regression by restoring regex to match tests (#17645) This fixes a regression that snuck in with #17108. When running a single test with `go test` the regex wouldn't be used anymore. This restores the old behavior. Release Notes: - Fixed a regression when running Go tests. A recent change dropped the regex used to match single test names when using `go test` in tasks to run tests. That could lead to more or the wrong tests being run. This restores the old behavior. --- crates/languages/src/go.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/languages/src/go.rs b/crates/languages/src/go.rs index c22a4e3eda..a528f4f70c 100644 --- a/crates/languages/src/go.rs +++ b/crates/languages/src/go.rs @@ -518,7 +518,13 @@ impl ContextProvider for GoContextProvider { GO_PACKAGE_TASK_VARIABLE.template_value(), VariableName::Symbol.template_value(), ), - command: format!("go test -run {}", VariableName::Symbol.template_value(),), + command: "go".into(), + args: vec![ + "test".into(), + GO_PACKAGE_TASK_VARIABLE.template_value(), + "-run".into(), + format!("^{}\\$", VariableName::Symbol.template_value(),), + ], tags: vec!["go-test".to_owned()], cwd: package_cwd.clone(), ..TaskTemplate::default()