Skip to content

proposal: testing: expose -fullpath to tests as T.FullPath #81618

Open

Description

@firelizzard18

Proposal Details

I propose adding func FullPath() bool to the testing package, analogous to Short/Verbose/CoverMode, so that a test that reports paths (separate from the path reported by t.Error/t.Log) can change it's behavior based on -fullpath.

Activity

  1. added this to the Proposal milestone on Sep 20, 2026
  2. changed the title [-]proposal: testing: expose -fullpath to tests[/-] [+]proposal: testing: expose -fullpath to tests as T.FullPath[/+] on Sep 22, 2026
  3. seankhliao commented on Sep 22, 2026

    @seankhliao
    Member

    I'm having a hard time understanding why you might want this vs always using the full path in non log output

  4. firelizzard18 commented on Sep 22, 2026

    @firelizzard18
    ContributorAuthor

    I am debugging a gopls analyzer, which uses golang.org/x/tools/go/analysis/analysistest to test itself. With -fullpath, the output will look something like:

    /path/to/analysistest.go:123: some_test_file.go:123:45: diagnostic ... does not match any expected diagnostic
    

    As far as why the authors of analysistest decided to use relative paths? If I had to guess, it would be that the tools repo has many deeply nested analyzers, and they felt that reporting full paths was noisy. And that's probably fine when you're running tests manually. But when I'm using something like vscode's testing API to execute tests, relative paths are problematic.

  5. seankhliao commented on Oct 2, 2026

    @seankhliao
    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions