Description
At tip-ish:
$ go version
go version devel +01b76d5fbc Tue Dec 8 19:45:23 2020 +0000 darwin/amd64
The TestDescriptionDocs
test passes when GOROOT_FINAL
is empty (vast majority of the time):
$ GOROOT_FINAL= go test -count=1 -v -run=TestDescriptionDocs runtime/metrics
=== RUN TestDescriptionDocs
--- PASS: TestDescriptionDocs (0.00s)
PASS
ok runtime/metrics 0.206s
But fails when non-empty:
$ GOROOT_FINAL=/usr/local/go go test -count=1 -v -run=TestDescriptionDocs runtime/metrics
=== RUN TestDescriptionDocs
description_test.go:39: open /usr/local/go/src/runtime/metrics/doc.go: no such file or directory
--- FAIL: TestDescriptionDocs (0.00s)
FAIL
FAIL runtime/metrics 0.127s
This is only a problem if it's important for runtime/metrics
tests to be able to pass when GOROOT_FINAL
is set. @mknyszek Is that an environment configuration you'd like to support?
If so, I suspect fixing the test can be done by simplifying:
// Get doc.go.
_, filename, _, _ := runtime.Caller(0)
filename = filepath.Join(filepath.Dir(filename), "doc.go")
f, err := os.Open(filename)
To just os.Open("doc.go")
, because go test
always sets the working directory to that of the package, so there's no need to do more.
This currently affects release testing (similarly to #39385, #39478, #39386 in the past), but we can easily work around it on our side by no longer setting GOROOT_FINAL
during release testing. (I think that's likely what we'll do independent of this issue, but it's a separate discussion. I think we may also want a builder where GOROOT_FINAL
is set to help catch such test failures.)
CC @bcmills, @golang/release.