Skip to content

testing: TestArtifactDirectoryPaths fails in GOPATH mode (no module context) #81263

Closed as not planned

Description

@levihackerman-102

What version of Go are you using?
go1.27.0 (also reproduced on go1.27rc3)

What operating system and processor architecture are you using?
linux/amd64 (Ubuntu stonking autopkgtest environment)

What did you do?
Run the stdlib testing package tests in GOPATH mode (GO111MODULE=off):

GOPATH=/tmp/gotest GO111MODULE=off go test -run TestArtifactDirectoryPaths -v testing

What did you expect to see?
Test passes, artifact directories include the package path component (e.g. _artifacts/subpkg/TestSubNiceName/...)

What did you see instead?
Test fails — artifact directories are missing the package path component:

    testing_test.go:1216: artifact directory for TestSubNiceName: got /tmp/.../001/_artifacts/TestSubNiceName/..., want suffix matching _artifacts/subpkg/TestSubNiceName/[^/]+$

Root cause
In runTests() (src/testing/testing.go:2700), when tests are invoked without module context, both modulePath and importPath are passed as empty strings:

ran, ok := runTests("", "", matchString, tests, deadline)

Then in relativeArtifactBase() (line 1535):

pkg := strings.TrimPrefix(c.importPath, c.modulePath)  // both empty -> pkg = ""

So the artifact directory has no package prefix. The test TestArtifactDirectoryPaths expects the package path to be present.

Impact
This affects Ubuntu's autopkgtest infrastructure (dh-golang), which runs stdlib tests in GOPATH mode. The jacobsa-crypto package's autopkgtest (which runs the stdlib testing tests) fails consistently.

Related to #77763 — the fix for that issue works in module mode but not in GOPATH mode.

Activity

  1. gabyhelp commented on Sep 1, 2026

    @gabyhelp

    Related Issues

    (Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

  2. prattmic commented on Sep 4, 2026

    @prattmic
    Member
  3. added
    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.
    on Sep 4, 2026
  4. cherrymui commented on Sep 4, 2026

    @cherrymui
    Member

    This affects Ubuntu's autopkgtest infrastructure (dh-golang), which runs stdlib tests in GOPATH mode.

    I'm curious why it does that. Is there a specific reason for that? Just to make sure standard library features work in GOPATH mode, or something else? Thanks.

  5. added
    WaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.
    on Sep 4, 2026
  6. dmitshur commented on Sep 4, 2026

    @dmitshur
    Member

    It may be helpful to hear back on the question above, but I'll note that testing standard library packages with GO111MODULE=off is documented as not something that's expected to work - see go help gopath or https://pkg.go.dev/cmd/go#hdr-GOPATH_mode_vendor_directories:

    [...] the standard library tests will not run properly with GO111MODULE=off.

    (I filed #81364 in case it's viable to make the go command surface this information more readily.)

  7. gopherbot commented on Oct 4, 2026

    @gopherbot
    Contributor

    Timed out in state WaitingForInfo. Closing.

    (I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

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

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.WaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions