golang/go

cmd/go: promote -fullpath from test flag to build flag

Open

#60,451 opened on May 26, 2023

View on GitHub
 (16 comments) (2 reactions) (0 assignees)Go (19,008 forks)batch import
GoCommandProposalProposal-Acceptedhelp wanted

Repository metrics

Stars
 (133,883 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

What version of Go are you using (go version)?

Does this issue reproduce with the latest release?

N/A

What did you do?

I ran this testscript:

! exec go test -C ./x -fullpath .
! stderr '\./x.go'

-- x/x.go --
package foo

var x = mistake

-- go.mod --
module test

What did you expect to see?

A passing test.

What did you see instead?

> ! exec go test -C ./x -fullpath .
[stdout]
FAIL
[stderr]
# test/x
./x.go:3:9: undefined: mistake
[exit status 1]
> ! stderr '\./x.go'
FAIL: /tmp/testscript142857279/x.txtar/script.txtar:2: unexpected match for `\./x.go` found in stderr: ./x.go

It seems to me that the intent of -fullpath is to cause all filenames to print in a way that's absolute, even when those errors come from the compiler rather than the test binary. I'd expect the compiler error to print an absolute path there too.

Contributor guide