1
0
mirror of https://github.com/golang/go synced 2024-11-18 07:14:44 -07:00
The Go programming language
Go to file
Dmitri Shuralyov 6e8caefc19 cmd/dist: emphasize when all tests are excluded
As observed in https://go.dev/issue/61666#issuecomment-1739476954,
if a -run flag value matches no tests, dist test output doesn't do much
to help users notice that was what happened. It is valid and sometimes
intended¹ to match no tests, so I want to reserve failed status with
exit code 1 to the actionable outcome where at least 1 test failed.
But it seems reasonable to extend the existing "some were excluded"
mechanism of reporting partial testing to be more helpful.

In non-JSON mode, which is more likely to be used manually by humans,
print a special² last line that will hopefully be easier to notice when
matching no tests wasn't intended. Change nothing for -json mode since
that's likely used by machines and they can make sense of 0 JSON events.

The go test command already has this behavior, so this brings dist test
closer³ to it. (Slightly unfortunate duplicate maintenance for us, and
the need for the rare dist test users to learn its CLI quirks; oh well.)

¹ It might seem counter-intuitive at first: what's the point of calling
  dist test and asking it to run no tests? One possible answer is that
  it permits writing code capable of running N intended tests, where N
  is 0 or higher. That is, it allows for 0 to not be a special case that
  the caller would have no choice but handle differently.
² I initially considered making it say something like "N of M tests were
  excluded", but decided to leave it alone since the current coordinator
  code still has that text hardcoded and I don't want to break it. Hence
  the new status that I expect only humans will see. And it seems better
  this way anyway.
³ In particular, the "matched no tests" and "no tests to run" phrases
  were selected precisely because they're already used in cmd/go output.

Change-Id: I6768d9932587195ae6dbc6e2c4742479e265733b
Reviewed-on: https://go-review.googlesource.com/c/go/+/532115
Reviewed-by: Austin Clements <austin@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2023-10-06 22:31:47 +00:00
.github .github: issue template for telemetry proposals 2023-09-14 21:29:10 +00:00
api html/template: support parsing complex JS template literals 2023-10-02 15:18:39 +00:00
doc net/http: add GODEBUG setting for old ServeMux behavior 2023-10-02 20:28:30 +00:00
lib/time
misc os: add tests for UserCacheDir and UserConfigDir 2023-08-21 17:46:57 +00:00
src cmd/dist: emphasize when all tests are excluded 2023-10-06 22:31:47 +00:00
test sync: use atomic.Uint32 in Once 2023-10-06 21:01:50 +00:00
.gitattributes
.gitignore internal/platform,cmd/dist: export the list of supported platforms 2023-06-22 19:44:52 +00:00
codereview.cfg
CONTRIBUTING.md
go.env
LICENSE
PATENTS
README.md
SECURITY.md SECURITY.md: update the Reporting a Vulnerability link 2023-09-22 21:17:24 +00:00

The Go Programming Language

Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.

Gopher image Gopher image by Renee French, licensed under Creative Commons 4.0 Attributions license.

Our canonical Git repository is located at https://go.googlesource.com/go. There is a mirror of the repository at https://github.com/golang/go.

Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file.

Download and Install

Binary Distributions

Official binary distributions are available at https://go.dev/dl/.

After downloading a binary release, visit https://go.dev/doc/install for installation instructions.

Install From Source

If a binary distribution is not available for your combination of operating system and architecture, visit https://go.dev/doc/install/source for source installation instructions.

Contributing

Go is the work of thousands of contributors. We appreciate your help!

To contribute, please read the contribution guidelines at https://go.dev/doc/contribute.

Note that the Go project uses the issue tracker for bug reports and proposals only. See https://go.dev/wiki/Questions for a list of places to ask questions about the Go language.