Skip to content

proposal: testing: flag to not truncate file names when logging  #55976

@firelizzard18

Description

@firelizzard18

I propose to add a flag to go test, such as -logabspath, that will print out the absolute path of the location of a call to (*testing.T).Log and friends instead of just the file name.

*testing.T methods that log (via (*testing.T).log) print out the location of the call, truncating the filename to just the basename. This may be helpful to users but it is problematic for tools like the VSCode Go extension. The Go extension's test support uses that location information to attach a log event to the source location. The extension assumes that such calls are made from files in the same package as the test, so this works in that case. However, it fails if those methods are called from a location outside of the test's package (if that location does not also call (*testing.T).Helper(). My proposal would provide an opt-in way for tooling such as the extension to change this behavior.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions