## TL;DR
`-run` matches each slash-separated level independently, so `go test -run TestSub` never matches a subtest nested under `TestTop`. Use the full path with slashes, `go test -run 'TestTop/TestSub'`, and anchor each level with `^...$` because every segment is an unanchored regex.

## Problem
Running `go test -run TestLoginValid` reports `ok` with zero tests run even though `TestLoginValid` exists as a subtest inside `TestLogin`.

## Steps
1. Confirm the nesting: find the parent test that calls `t.Run("TestLoginValid", ...)`.
   Expected: you know the parent name, for example `TestLogin`.
2. Run with the slash-separated path, quoting the pattern:
   ```bash
   go test ./auth -run 'TestLogin/TestLoginValid' -v
   ```
   Expected: the subtest runs and `-v` shows `=== RUN TestLogin/TestLoginValid`.
3. Anchor each level so similarly named tests do not sneak in (`TestLogin` also matches `TestLoginExtra`):
   ```bash
   go test ./auth -run '^TestLogin$/^TestLoginValid$' -v
   ```
   Expected: only the exact parent and subtest run.
4. To run ALL subtests of a parent, end the pattern after the parent's slash:
   ```bash
   go test ./auth -run '^TestLogin$/' -v
   ```
   Expected: every subtest under `TestLogin` runs.

## When to use
- `-run` with a subtest name runs nothing.
- You want one subtest, not the whole parent.
- CI shards that select tests by name.

## When not to use
- Top-level tests: plain `-run '^TestLogin$'` is enough.
- Table tests driven by a slice (not `t.Run`): filter inside the test or split them into subtests.
- Fuzz targets: use `-fuzz`, not `-run`.

## Tool compatibility
- Go 1.22 through 1.24 `go test`; the `-run` slash-splitting behavior is long-standing and unchanged.

## Variant phrasings
### go test -run with slash pattern matches nothing
Each segment is matched against that level only; a typo in the parent segment silently matches zero parents. Print with `-v` to see what actually ran.
### go test -run runs too many similarly named tests
Segments are unanchored regexes; add `^` and `$` around each level.

## Why it happens
`-run` splits the pattern on unescaped slashes and matches segment 1 against top-level test names, segment 2 against their subtests, and so on. A bare subtest name is compared against top-level names, matches nothing, and the subtests are never reached.

## Edge cases
- Subtest names with spaces get sanitized (spaces become underscores); match the sanitized form.
- `-run` alone does not disable the test cache; add `-count=1` if you suspect caching is hiding the skip.
- Regex metacharacters in test names (for example `Test[0]`) must be escaped in the pattern.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_GREq6x30-hJSPVShay3Umg
