Skip to content

proposal: cmd/go: allow test binaries to identify as uncacheable #23799

@dsymonds

Description

@dsymonds

The new test caching stuff is neat, except when a test has an external dependency (e.g. it is testing code that hits a web service), and we don't want the test's result to be cached (so that we're always exercising the code against the real world).

There are ways to disable the test caching from the user's perspective (e.g. passing -count=1), but not from the test itself from what I can tell. It'd be nice if tests in this position could do something to indicate to the go tool that its result and output should not be cached.

Some ideas:

  • Have a method on *testing.T that can be invoked to signal this.
  • Have a specified file to touch (e.g. $GOCACHE/something).
  • Have a naming convention for such tests (e.g. must have an External substring).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Incoming

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions