Currently, t.Error calls print only the base name of the source file.
This is fine when running a single test, but in larger projects, it is a significant productivity boost to have relative (or full) path names, which make the “jump to next compilation error” feature in popular editors work.
I understand the outcome of #21119 (can’t change the default), but I suggest adding a knob to opt into printing relative or full paths.
Perhaps this could be similar to log.SetFlags, where you can specify Llongfile or Lshortfile?
Let me know if this would be okay, and I’d be happy to send a CL.
The text was updated successfully, but these errors were encountered:
It's unfortunate that we can't change the default. However, there is some precedent for such an opt-in flag:
$ go tool compile -h 2>&1 | grep -- -L
-L show full file names in error messages
I also wonder if go test could transform filename paths transparently, when it buffers output from test binaries. The only case where the test binary output goes straight to the terminal is when go test is run without arguments - and, in that case, the paths are already relative to the current directory, as we're testing the package in the current directory too. Transforming paths should be possible to do, given that test2json does very similar parsing of plaintext test output.