[go] testing: fix construction of the testing artifacts path

3 views
Skip to first unread message

Gerrit Bot (Gerrit)

unread,
Feb 24, 2026, 4:38:06 PM (12 hours ago) Feb 24
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Gerrit Bot has uploaded the change for review

Commit message

testing: fix construction of the testing artifacts path

The existing implementation constructs a path which starts with a forward
slash, which is then immediately rejected by filepath.Localize() as
invalid. This change simple removes the first forward slash.

Fixes #77763
Change-Id: I00fc7381b939e4d8a8a9811e2a95fc2d8c5a6e84
GitHub-Last-Rev: a55a229f0434612ff301c9beedb7e37b5d6f00b1
GitHub-Pull-Request: golang/go#77778

Change diff

diff --git a/src/testing/testing.go b/src/testing/testing.go
index 34b45b4..0c85540 100644
--- a/src/testing/testing.go
+++ b/src/testing/testing.go
@@ -1377,7 +1377,7 @@

// Join with /, not filepath.Join: the import path is /-separated,
// and we don't want removeSymbolsExcept to strip \ separators on Windows.
- base := "/" + pkg + "/" + name
+ base := pkg + "/" + name
base = removeSymbolsExcept(base, "!#$%&()+,-.=@^_{}~ /")
base, err := filepath.Localize(base)
if err != nil {
diff --git a/src/testing/testing_test.go b/src/testing/testing_test.go
index 167f4a0..2760e31 100644
--- a/src/testing/testing_test.go
+++ b/src/testing/testing_test.go
@@ -1142,6 +1142,12 @@
t.Fatalf("want artifact directory contained in %q, got %q", outputDir, artifactDir)
}

+ slashDir := filepath.ToSlash(relDir)
+ parts := strings.Split(slashDir, "/")
+ if len(parts) < 4 || parts[0] != "_artifacts" {
+ t.Errorf("expected artifact directory to have structure _artifacts/<pkg>/<name>/<random>, got %q", slashDir)
+ }
+
for _, part := range strings.Split(relDir, string(os.PathSeparator)) {
const maxSize = 64
if len(part) > maxSize {

Change information

Files:
  • M src/testing/testing.go
  • M src/testing/testing_test.go
Change size: XS
Delta: 2 files changed, 7 insertions(+), 1 deletion(-)
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I00fc7381b939e4d8a8a9811e2a95fc2d8c5a6e84
Gerrit-Change-Number: 748581
Gerrit-PatchSet: 1
Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Gopher Robot (Gerrit)

unread,
Feb 24, 2026, 4:40:23 PM (12 hours ago) Feb 24
to Gerrit Bot, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Message from Gopher Robot

Congratulations on opening your first change. Thank you for your contribution!

Next steps:
A maintainer will review your change and provide feedback. See
https://go.dev/doc/contribute#review for more info and tips to get your
patch through code review.

Most changes in the Go project go through a few rounds of revision. This can be
surprising to people new to the project. The careful, iterative review process
is our way of helping mentor contributors and ensuring that their contributions
have a lasting impact.

During May-July and Nov-Jan the Go project is in a code freeze, during which
little code gets reviewed or merged. If a reviewer responds with a comment like
R=go1.11 or adds a tag like "wait-release", it means that this CL will be
reviewed as part of the next development cycle. See https://go.dev/s/release
for more details.

Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I00fc7381b939e4d8a8a9811e2a95fc2d8c5a6e84
Gerrit-Change-Number: 748581
Gerrit-PatchSet: 1
Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
Gerrit-CC: Gopher Robot <go...@golang.org>
Gerrit-Comment-Date: Tue, 24 Feb 2026 21:40:18 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
unsatisfied_requirement
satisfied_requirement
open
diffy

Russ Egan (Gerrit)

unread,
Feb 24, 2026, 5:31:20 PM (11 hours ago) Feb 24
to Gerrit Bot, goph...@pubsubhelper.golang.org, Alan Donovan, Damien Neil, Marcel van Lohuizen, Gopher Robot, golang-co...@googlegroups.com
Attention needed from Alan Donovan and Damien Neil

Russ Egan added 1 comment

Patchset-level comments
File-level comment, Patchset 1 (Latest):
Russ Egan . unresolved

I intentionally left the new assertion pretty lenient...it still doesn't enforce the exact format of the constructed path. But I don't think that is sufficient. While debugging this, I found an additional bug in the derivation of the path when the test is in the root of a module.

I think I need to add an assertion about the exact derived path prefix.

Open in Gerrit

Related details

Attention is currently required from:
  • Alan Donovan
  • Damien Neil
Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I00fc7381b939e4d8a8a9811e2a95fc2d8c5a6e84
    Gerrit-Change-Number: 748581
    Gerrit-PatchSet: 1
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alan Donovan <adon...@google.com>
    Gerrit-Reviewer: Damien Neil <dn...@google.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Marcel van Lohuizen <mp...@golang.org>
    Gerrit-CC: Russ Egan <russe...@gmail.com>
    Gerrit-Attention: Damien Neil <dn...@google.com>
    Gerrit-Attention: Alan Donovan <adon...@google.com>
    Gerrit-Comment-Date: Tue, 24 Feb 2026 22:31:10 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    unsatisfied_requirement
    open
    diffy

    Damien Neil (Gerrit)

    unread,
    Feb 24, 2026, 6:57:11 PM (10 hours ago) Feb 24
    to Gerrit Bot, goph...@pubsubhelper.golang.org, Russ Egan, Alan Donovan, Marcel van Lohuizen, Gopher Robot, golang-co...@googlegroups.com
    Attention needed from Alan Donovan

    Damien Neil voted and added 1 comment

    Votes added by Damien Neil

    Auto-Submit+1
    Code-Review+2
    Commit-Queue+1

    1 comment

    Patchset-level comments
    Damien Neil . resolved

    Thanks.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Alan Donovan
    Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I00fc7381b939e4d8a8a9811e2a95fc2d8c5a6e84
    Gerrit-Change-Number: 748581
    Gerrit-PatchSet: 1
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alan Donovan <adon...@google.com>
    Gerrit-Reviewer: Damien Neil <dn...@google.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Marcel van Lohuizen <mp...@golang.org>
    Gerrit-CC: Russ Egan <russe...@gmail.com>
    Gerrit-Attention: Alan Donovan <adon...@google.com>
    Gerrit-Comment-Date: Tue, 24 Feb 2026 23:57:06 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Damien Neil (Gerrit)

    unread,
    Feb 24, 2026, 6:58:13 PM (10 hours ago) Feb 24
    to Gerrit Bot, goph...@pubsubhelper.golang.org, Go LUCI, Russ Egan, Alan Donovan, Marcel van Lohuizen, Gopher Robot, golang-co...@googlegroups.com
    Attention needed from Alan Donovan

    Damien Neil added 1 comment

    Patchset-level comments
    Russ Egan . unresolved

    I intentionally left the new assertion pretty lenient...it still doesn't enforce the exact format of the constructed path. But I don't think that is sufficient. While debugging this, I found an additional bug in the derivation of the path when the test is in the root of a module.

    I think I need to add an assertion about the exact derived path prefix.

    Damien Neil

    Would you rather fix the additional problem in a followup CL, or in this one? Either seems fine to me.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Alan Donovan
    Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I00fc7381b939e4d8a8a9811e2a95fc2d8c5a6e84
    Gerrit-Change-Number: 748581
    Gerrit-PatchSet: 1
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alan Donovan <adon...@google.com>
    Gerrit-Reviewer: Damien Neil <dn...@google.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Marcel van Lohuizen <mp...@golang.org>
    Gerrit-CC: Russ Egan <russe...@gmail.com>
    Gerrit-Attention: Alan Donovan <adon...@google.com>
    Gerrit-Comment-Date: Tue, 24 Feb 2026 23:58:09 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Russ Egan <russe...@gmail.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Gerrit Bot (Gerrit)

    unread,
    Feb 24, 2026, 10:45:16 PM (6 hours ago) Feb 24
    to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
    Attention needed from Alan Donovan and Damien Neil

    Gerrit Bot uploaded new patchset

    Gerrit Bot uploaded patch set #2 to this change.
    Following approvals got outdated and were removed:
    • Code-Review: +2 by Damien Neil
    • TryBots-Pass: LUCI-TryBot-Result-1 by Go LUCI
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Alan Donovan
    • Damien Neil
    Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: newpatchset
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I00fc7381b939e4d8a8a9811e2a95fc2d8c5a6e84
    Gerrit-Change-Number: 748581
    Gerrit-PatchSet: 2
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alan Donovan <adon...@google.com>
    Gerrit-Reviewer: Damien Neil <dn...@google.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Marcel van Lohuizen <mp...@golang.org>
    Gerrit-CC: Russ Egan <russe...@gmail.com>
    unsatisfied_requirement
    open
    diffy

    Russ Egan (Gerrit)

    unread,
    Feb 24, 2026, 10:50:20 PM (6 hours ago) Feb 24
    to Gerrit Bot, goph...@pubsubhelper.golang.org, Go LUCI, Damien Neil, Alan Donovan, Marcel van Lohuizen, Gopher Robot, golang-co...@googlegroups.com
    Attention needed from Alan Donovan and Damien Neil

    Russ Egan added 1 comment

    Patchset-level comments
    Russ Egan . unresolved

    I intentionally left the new assertion pretty lenient...it still doesn't enforce the exact format of the constructed path. But I don't think that is sufficient. While debugging this, I found an additional bug in the derivation of the path when the test is in the root of a module.

    I think I need to add an assertion about the exact derived path prefix.

    Damien Neil

    Would you rather fix the additional problem in a followup CL, or in this one? Either seems fine to me.

    Russ Egan

    I'll fix it here...working on it now.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Alan Donovan
    • Damien Neil
    Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I00fc7381b939e4d8a8a9811e2a95fc2d8c5a6e84
    Gerrit-Change-Number: 748581
    Gerrit-PatchSet: 2
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alan Donovan <adon...@google.com>
    Gerrit-Reviewer: Damien Neil <dn...@google.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Marcel van Lohuizen <mp...@golang.org>
    Gerrit-CC: Russ Egan <russe...@gmail.com>
    Gerrit-Attention: Damien Neil <dn...@google.com>
    Gerrit-Attention: Alan Donovan <adon...@google.com>
    Gerrit-Comment-Date: Wed, 25 Feb 2026 03:50:11 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Russ Egan <russe...@gmail.com>
    Comment-In-Reply-To: Damien Neil <dn...@google.com>
    unsatisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages