languages: Fix command used for Go subtests#42734
Merged
Conversation
The command used to run go subtests was breaking if the test contained square brackets, for example: ``` go test . -v -run ^TestInventoryCheckout$/^\[test\]_test_checkout$ ``` After a bit of testing it appears that the best way to actually resolve this in a way supported by `go test` is to wrap this command in quotes. As such, this commit updates the command to, considering the example above: ``` go test . -v -run '^TestInventoryCheckout$/^\[test\]_test_checkout$' ``` We also tested escape the square brackets, using `\\\[` instead of `\[`, but that would lead to a more complex change, so we opted for the simpler solution of wrapping the command in quotes.
11happy
pushed a commit
to 11happy/zed
that referenced
this pull request
Dec 1, 2025
The command used to run go subtests was breaking if the test contained square brackets, for example: ``` go test . -v -run ^TestInventoryCheckout$/^\[test\]_test_checkout$ ``` After a bit of testing it appears that the best way to actually resolve this in a way supported by `go test` is to wrap this command in quotes. As such, this commit updates the command to, considering the example above: ``` go test . -v -run '^TestInventoryCheckout$/^\[test\]_test_checkout$' ``` We also tested escape the square brackets, using `\\\[` instead of `\[`, but that would lead to a more complex change, so we opted for the simpler solution of wrapping the command in quotes. Closes zed-industries#42347 Release Notes: - Fixed command used to run Go subtests to ensure that escaped characters don't lead to a failure in finding tests to run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The command used to run go subtests was breaking if the test contained square brackets, for example:
After a bit of testing it appears that the best way to actually resolve this in a way supported by
go testis to wrap this command in quotes. As such, this commit updates the command to, considering the example above:We also tested escape the square brackets, using
\\\[instead of\[, but that would lead to a more complex change, so we opted for the simpler solution of wrapping the command in quotes.Closes #42347
Release Notes: